自动关联数据删除（支持一对一及一对多关联）
@access public
@return void
331879
protected function autoRelationDelete()
    {
        foreach ($this->relationWrite as $key => $name) {
            $name   = is_numeric($key) ? $name : $key;
            $result = $this->getRelation($name);

            if ($result instanceof Model) {
                $result->delete();
            } elseif ($result instanceof Collection) {
                foreach ($result as $model) {
                    $model->delete();
                }
            }
        }
    }
205372
public function execute()
    {
        $data = $this->getData();

        /*
         * Step 1) Apply sorting
         *
         * @see http://php.net/manual/de/function.array-multisort.php
         * @see example number 3
         */
        if (!empty($this->getSortConditions())) {
            $data = $this->sortArrayMultiple($data, $this->getSortConditions());
        }

        /*
         * Step 2) Apply filters
         */
        foreach ($this->getFilters() as $filter) {
            /* @var $filter \ZfcDatagrid\Filter */
            if ($filter->isColumnFilter() === true) {
                $data = array_filter($data, [
                    new PhpArray\Filter($filter),
                    'applyFilter',
                ]);
            }
        }

        /**
         * Step 3) Remove unneeded columns.
         *
         * @todo ? Better performance or let it be?
         */
        $selectedColumns = [];
        foreach ($this->getColumns() as $col) {
            if (! $col instanceof Column\Select) {
                continue;
            }

            $colString = $col->getSelectPart1();
            if ($col->getSelectPart2() != '') {
                $colString = $col->getSelectPart1().'_'.$col->getSelectPart2();
            }

            $selectedColumns[] = $colString;
        }

        foreach ($data as &$row) {
            foreach ($row as $keyRowCol => $rowCol) {
                if (! in_array($keyRowCol, $selectedColumns)) {
                    unset($row[$keyRowCol]);
                }
            }
        }

        /*
         * Step 4) Pagination
         */
        $this->setPaginatorAdapter(new PaginatorAdapter($data));
    }
873815
public static function init() : void
    {
        if ( ! empty($_SESSION[Notification::SESSION_KEY]) && is_array($_SESSION[Notification::SESSION_KEY])) {
            Notification::$notifications = $_SESSION[Notification::SESSION_KEY];
        }

        $_SESSION[Notification::SESSION_KEY] = [];
    }
734008
public function execute()
    {
        $this->insertID = $this->table->insertOne($this->context + $this->data);
        parent::execute();
    }
993028
public function handle()
    {
        $topicName = trim($this->argument('topic'));

        $prefix = trim($this->option('prefix'));
        $max = trim($this->option('max'));
        $next = trim($this->option('next'));

        /**
         * @var Client
         */
        $client = $this->mns;
        if (!$client) {
            $this->error('请先配置阿里云MSN服务，并在DI里面注册');

            return;
        }

        try {
            $data = [];
            $topic = $client->getTopicRef($topicName);
            $res = $topic->listSubscription($max, $prefix, $next);
            if ($res->isSucceed()) {
                foreach ($res->getSubscriptionNames() as $subscriptionName) {
                    $subscription['name'] = $subscriptionName;

                    $attr = $topic->getSubscriptionAttribute($subscriptionName)->getSubscriptionAttributes();

                    $subscription['endpoint'] = $attr->getEndpoint();
                    $subscription['filterTag'] = $attr->getFilterTag();
                    $subscription['strategy'] = $attr->getStrategy();
                    $subscription['contentFormat'] = $attr->getContentFormat();
                    $subscription['createTime'] = date('Y-m-d H:i:s', $attr->getCreateTime());
                    $subscription['updateTime'] = date('Y-m-d H:i:s', $attr->getLastModifyTime());
                    $data[] = $subscription;
                }
            }


            $subscriptionHeaders = ['Name', 'Endpoint', 'FilterTag', 'Strategy', 'ContentFormat', 'CreateTime', 'UpdateTime'];
            $this->line("List of Subscriptions for Topic: $topicName");
            $this->table($subscriptionHeaders, $data);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
484597
public function reset()
    {
        $this->values[self::_PUBLIC] = null;
        $this->values[self::_PRIVATE] = null;
    }
1114960
public function first() {
		$this->limit(1);
		$result = $this->find();
		return empty($result) ? null : $result[0];
	}
1094033
public function valid()
    {
        if (!parent::valid()) {
            return false;
        }

        $current = $this->current();
        $key = $this->key();
        $condition = $this->_condition;

        return !$condition($current, $key, $this->_innerIterator);
    }
671433
public function pass() {
    if ($this->output && !$this->output->isQuiet()) {
      $this->output->write(".");
    }
    $this->passed += 1;
  }
1154297
public function end(): void
    {
        $this->current = $this->tail->prev();
        $this->offset = $this->count - 1;
    }
996166
public function execute()
    {
        if (!$this->isEmpty()) {
            $this->table->delete($this->context + $this->where)->run();
        }

        parent::execute();
    }
82043
public function value($value): void
    {
        $obj = array_pop($this->stack);
        if (!empty($this->keys[$this->level])) {
            $obj[$this->keys[$this->level]] = $value;
            $this->keys[$this->level] = null;
        } else {
            $obj[] = $value;
        }
        $this->stack[] = $obj;
    }
866125
public function disconnect(): void
  {
    if ($this->mysqli!==null)
    {
      $this->mysqli->close();
      $this->mysqli = null;
    }
  }
1313793
public function valid()
    {
        if (is_null($this->current)) {
            $this->next();
        }

        return ! is_null($this->current) && $this->isValidPosition;
    }
1178516
public function next(): void
    {
        $innerIterator = $this->getInnerIterator();
        $this->valid = $innerIterator->valid();

        if ($this->valid === false) {
            return;
        }

        $this->key = $innerIterator->key();
        $this->current = $innerIterator->current();

        $innerIterator->next();
    }
444346
public function flush()
    {
        $this->_result = null;
        $this->_lastResult = array();
        $this->_lastQuery = null;
        $this->_lastQueryHash = null;
    }
1372122
public function delete()
    {
        self::$instance->reset();
        $this->sql('DELETE');
        $this->oosql_where = null;
        $numargs = func_num_args();

        if ($numargs > 0) {
            if ($numargs > 1) {
                $this->oosql_del_multiFlag = true;
                $this->oosql_del_numargs = $numargs;
            }
            $arg_list = func_get_args();
            if (is_array($arg_list[0])) {
                $this->sql(' FROM ' . $this->oosql_table);
                $this->where($arg_list[0][0] . ' = ?', $arg_list[0][1]);
                return $this;
            }
            $this->oosql_sql .= ' FROM';
            for ($i = 0; $i < $numargs; $i++) {
                if ($i != 0 && $numargs > 1) {
                    $this->sql(',');
                }
                $this->sql(' ' . $arg_list[$i]);
            }

        } else {
            $this->oosql_fromFlag = true;
        }


        return $this;
    }