Returns a representation of this object that can be passed to
Cake\ORM\EagerLoader::contain()

@return array
429014
public function asContainArray()
    {
        $associations = [];
        foreach ($this->_associations as $assoc) {
            $associations += $assoc->asContainArray();
        }
        $config = $this->_config;
        if ($this->_forMatching !== null) {
            $config = ['matching' => $this->_forMatching] + $config;
        }

        return [
            $this->_name => [
                'associations' => $associations,
                'config' => $config
            ]
        ];
    }
1049971
public function getAllEntitiesToArray()
    {
        $entities = $this->getAll();
        $array = [];
        foreach ($entities as $entity) {
            $depth = isset($entity->depth) ? str_repeat('— ', $entity->depth) : '';
            $title = $entity->title ?? $entity->name;
            $array[$entity->id] = $depth . $title;
        }
        return $array;
    }
205629
public function getFullDataSet () : array
    {
        if ($this->isUsingHandler()) :
            $this->regularize();
            $this->clearCache();

            return $this->_Cache = $this->_DataHandler->selectRangeEntitys(0,$this->_maxKey + 1);
        else :
            return $this->_Container;
        endif;
    }
1300702
public function filtering()
    {
        if ($this->request->hasHeader('search-protection')) {
            $this->request->setSearchableColumnIndex($this->columns, $this->columnDef['filter']);
        }
        $columns          = $this->request['columns'];
        $this->collection = $this->collection->filter(function ($row) use ($columns) {
            $data                  = $this->serialize($row);
            $this->isFilterApplied = true;
            $found                 = [];

            $keyword = $this->request->keyword();
            foreach ($this->request->searchableColumnIndex() as $index) {
                $column = $this->getColumnName($index);
                if (!$value  = Arr::get($data, $column)) {
                    continue;
                }

                if ($this->isCaseInsensitive()) {
                    $found[] = Str::contains(Str::lower($value), Str::lower($keyword));
                } else {
                    $found[] = Str::contains($value, $keyword);
                }
            }

            return in_array(true, $found);
        }
        );
    }
735222
public function getExcluded(): array
    {
        $arr = [];
        foreach ($this->columns as $name => $column) {
            if ($column->isExcluded()) {
                $arr[] = $name;
            }
        }

        return $arr;
    }
1027136
public function getOrphans()
    {
        $table = ORM::getTable($this->getTable()->getPlugin(), 'Image');
        $q = $table->createSelectQuery();
        $e = $q->expr;
        $q->where($e->lAnd(
            $e->eq('section', $q->bindValue($this->id, null, PDO::PARAM_INT)),
            $e->eq('groupId', $q->bindValue(0, null, PDO::PARAM_INT))
        ));
        return $table->loadFromQuery($q);
    }
292816
public function availableIncludeKeys(): array
    {
        $availableKeys = [];
        if (($transformer = $this->transformer()) !== null && ($transformer instanceof  TransformerInterface)) {
            $availableKeys = $transformer->getAvailableIncludes();
        }

        return $availableKeys;
    }
567991
function contains($element)
    {
        if(get_class($element) !== $this->manager->getModel()){
            return false;
        }
        return  array_search($element, $this->elements, true);
    }
468245
public function contains($value)
    {
        if (\is_array($value)) {
            /** @noinspection ForeachSourceInspection */
            foreach ($value as $item) {
                $this->contains($item);
            }
        } else {
            $this->predicates[] = '*' . $this->processValue($value) . '*';
        }

        return $this;
    }
352072
protected function query()
	{
		$query = forward_static_call(
			[
				$this->getModelClass(),
				'query',
			]
		);

		$this->modifyQuery($query);

		$eager_loads = $this->getEagerLoads();

		if ( !empty($eager_loads)) {
			$this->safeWith($query, $eager_loads);
		}

		if ( !empty($modifiers = $this->getModifiers())) {
			foreach ($modifiers as $modifier) {
				$modifier($query);
			}
		}

		return $query;
	}
306143
public static function all()
    {
        $class = get_called_class();
        $object = new $class();
        $table = $object->_table;
        $key = $object->_keyName;
        //
        $data = Query::table($table)->select('*')->where("'true'", '=', 'true');
        //
        if ($object->_canKept) {
            $data = $data->orGroup(
            'and',
            Query::condition('deleted_at', '>', Time::current()),
            Query::condition('deleted_at', 'is', 'NULL', false));
        }

        if ($object->_canStashed) {
            $data = $data->orGroup(
            'and',
            Query::condition('appeared_at', '<=', Time::current()),
            Query::condition('appeared_at', 'is', 'NULL', false));
        }
        //
        $data = $data->get(Query::GET_ARRAY);
        //
        return self::collect($data, $table, $key);
    }
34220
public function contains($value, bool $recursive = false, bool $strict = true): bool
    {
        if ($recursive === true) {
            return $this->in_array_recursive($value, $this->getArray(), $strict);
        }

        foreach ($this->getGenerator() as $valueFromArray) {
            if ($strict) {
                if ($value === $valueFromArray) {
                    return true;
                }
            } else {
                /** @noinspection NestedPositiveIfStatementsInspection */
                if ($value == $valueFromArray) {
                    return true;
                }
            }
        }

        return false;
    }
109845
public function contains( $key, $value = null )
	{
		if ( func_num_args() == 2 )
		{
			return parent::contains( $key, $value );
		}

		if ( $this->useAsCallable( $key ) )
		{
			return parent::contains( $key );
		}

		$key = $key instanceof Model ? $key->getKey() : $key;

		return parent::contains( function ( $k, $m ) use ( $key )
		{
			return $m->getKey() == $key;
		} );
	}
1102194
public function getIncludedColumn()
    {
        $model  = $this->config->getDataModel();
        $nested = $this->getOption('nested');
        $fk     = $nested['models'][0]->{$nested['pieces'][0]}()->getForeignKey();

        return array($fk => $model->getTable().'.'.$fk);
    }
661087
public function contains(callable $callback)
    {
        foreach (array_keys($this->storage) as $priority) {
            if (false !== ($index = array_search($callback, $this->storage[$priority], true))) {
                return true;
            }
        }
        return false;
    }
214197
public function transformToArray()
    {
        $transformedEd               = [];
        $transformedEd['collection'] = $this->getRelation();
        $transformedEd['from']       = $this->getFromCollections();
        $transformedEd['to']         = $this->getToCollections();

        return $transformedEd;
    }
639427
protected function eagerLoadRelations()
    {
        $query = $this->model;

        if (is_array($this->eagerLoadRelations)) {
            $eagerLoads = [];

            foreach ($this->eagerLoadRelations as $relation => $rules) {
                // case for relations[]=relation_name
                // with relation that is numeric
                $relation = (is_integer($relation)) ? $rules : $relation;

                // case for relations[relation_name][attributes][]=attrib_name
                // with relation that is a relation name
                if (is_array($rules) && array_key_exists('attributes', $rules)) {
                    $eagerLoads[$relation] = function ($q) use ($rules) {
                        // If query is instance of HasOneOrMany,
                        // make sure to select the parent key name as foreign key.
                        if (
                            $q instanceof HasOneOrMany &&
                            !in_array($fk = $q->getParent()->getForeignKey(), $rules['attributes'])
                        ) {
                            array_push($rules['attributes'], $fk);
                        }

                        $q->select($rules['attributes']);
                    };
                } else {
                    array_push($eagerLoads, $relation);
                }
            }

            return $query->with($eagerLoads);
        }

        return $query->with($this->eagerLoadRelations);
    }