Get images owned by a user

@param ImagesQuery $query An optional images query object
@return Model
432245
public function getImages(ImagesQuery $query = null) {
        if (!$query) {
            $query = new ImagesQuery();
        }

        $params = array(
            'user' => $this->getUser(),
            'page' => $query->page(),
            'limit' => $query->limit(),
        );

        if ($query->metadata()) {
            $params['metadata'] = true;
        }

        if ($from = $query->from()) {
            $params['from'] = $from;
        }

        if ($to = $query->to()) {
            $params['to'] = $to;
        }

        if ($fields = $query->fields()) {
            $params['fields'] = $fields;
        }

        if ($sort = $query->sort()) {
            $params['sort'] = $sort;
        }

        if ($ids = $query->ids()) {
            $params['ids'] = $ids;
        }

        if ($checksums = $query->checksums()) {
            $params['checksums'] = $checksums;
        }

        if ($originalChecksums = $query->originalChecksums()) {
            $params['originalChecksums'] = $originalChecksums;
        }

        $response = $this->getCommand('GetImages', $params)->execute();
        $response['images'] = array_map(
            array('ImboClient\Helper\PublicKeyFallback', 'fallback'),
            $response['images']
        );

        return $response;
    }
1155093
public function getScopes($query, $scopes)
    {
        if ($scopes & self::DEFAULT) {
            return $query;
        }

        if ($scopes & self::WITH_DELETED) {
            return $query->withTrashed();
        }

        if ($scopes & self::DELETED_ONLY) {
            return $query->onlyTrashed();
        }

        return $query;
    }
116219
public function getReverseImagesQuery($data, $inputs)
    {
        foreach ($inputs as $input) {
            $data[] = ['output' => $this->setData(['image' => ['url' => $input->getImage()]], 'input')];
        }

        return $data;
    }
1107385
protected function getValueFromRelationQuery($query)
    {
        // Query must be a relation in this case, since we need the related model
        if ( ! ($query instanceof BelongsToMany)) {
            throw new UnexpectedValueException("Query must be BelongsToMany Relation instance for " . get_class($this));
        }

        /** @var BelongsToMany $query */

        $relatedModel = $query->getRelated();
        $keyName      = $relatedModel->getKeyName();
        $table        = $relatedModel->getTable();
        $pivotTable   = $query->getTable();
        $orderColumn  = $this->getPivotOrderColumn();

        $query = $this->prepareRelationQuery(
            $query
                ->withPivot([ $orderColumn ])
                ->orderBy($pivotTable . '.' . $orderColumn)
        );

        // Get only the relevant columns: key and pivot
        return $query->pluck($pivotTable . '.' . $orderColumn, $table . '.' . $keyName);
    }
1024171
public function findOne($query = [], $fields = [])
    {
        if (is_string($query)) {
            return $this->collection->findOne($query, $fields = []);
        }

        return parent::findOne($query, $fields);
    }
347149
public function setLazyLoaded($query)
	{
		if( ! empty($this->getLazyLoad()))
		{
			$query = $query->load($this->getLazyLoad());
		}

		return $query;
	}
8557
protected function getImageSizes()
    {
        if (is_callable($this->_imageSizes)) {
            return call_user_func($this->_imageSizes, $this->owner);
        } else {
            return $this->_imageSizes;
        }
    }
811322
public function getImagesQuery($data, $inputs)
    {
        foreach ($inputs as $input) {
            $data[] = $this->setData(['image' => ['url' => $input->getImage()]], 'input');
        }

        return $data;
    }
428808
public function findOne(array $query = null)
    {
        $data = (clone $this)->where($query)->fetchData();

        if (empty($data[0])) {
            return null;
        }

        return $this->orm->make($this->class, $data[0], ORMInterface::STATE_LOADED, true);
    }
913892
protected function processSingleResult($query)
    {
        if (!empty($this->fetchRefs)) {
            $res = $query->fetch();
            $model = ($res ? $this->populateModelFromJoin($res) : $res);
        } else {
            $model = $query->fetchClass($this->modelClass);
        }
        if ($model && isset($this->manager)) {
            $this->manager->manageModel($model);
        }
        $this->fetchReferences(false);
        return $model;
    }
830885
public function doPostTaxonomyFiltering($query)
    {
        // Do not execute this in admin view
        if (is_admin() || !(is_archive() || is_home() || is_category() || is_tax() || is_tag()) || !$query->is_main_query()) {
            return $query;
        }

        $postType = $this->getPostType();
        $filterable = $this->getEnabledTaxonomies($postType, false);

        if (empty($filterable)) {
            return $query;
        }

        $taxQuery = array('relation' => 'AND');

        foreach ($filterable as $key => $value) {
            if (!isset($_GET['filter'][$key]) || empty($_GET['filter'][$key]) || $_GET['filter'][$key] === '-1') {
                continue;
            }

            $terms = (array)$_GET['filter'][$key];

            $taxQuery[] = array(
                'taxonomy' => $key,
                'field' => 'slug',
                'terms' => $terms,
                'operator' => 'IN'
            );
        }

        if (is_tax() || is_category() || is_tag()) {
            $taxQuery = array(
                'relation' => 'AND',
                array(
                    'relation' => 'AND',
                    array(
                        'taxonomy' => get_queried_object()->taxonomy,
                        'field' => 'slug',
                        'terms' => (array)get_queried_object()->slug,
                        'operator' => 'IN'
                    )
                ),
                $taxQuery
            );
        }

        $taxQuery = apply_filters('Municipio/archive/tax_query', $taxQuery, $query);

        $query->set('tax_query', $taxQuery);
        return $query;
    }
1321554
public function getImagesWithQuery(int $id, array $query): array
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureForImagesWithQuery($id, ['query' => $query]);

        return $parent->getGenerator()->create($closure, Image::class, $this->parent->getAcceptedLanguages(), true);
    }
205473
protected function _findEncryptedFilterData(Query $query, ServerRequest $request)
    {
        return $query
            ->select($this->getAlias() . '.filter_data')
            ->where([
                $this->getAlias() . '.controller' => $request->getParam('controller'),
                $this->getAlias() . '.action' => $request->getParam('action'),
                $this->getAlias() . '.slug' => $request->getParam('sluggedFilter')
            ])
            ->where($this->_pluginCondition($request));
    }
1289780
public function search($query)
    {
        $criteria = [];
        foreach ($query as $term) {
            $criteria[$term->name] = $term->toparam();
        }
        $pager = [
            'object' => $this,
            'method' => 'fetchDisputes',
            'query' => $criteria
        ];
        return new PaginatedCollection($pager);
    }
596189
public function find($query, $fields = ['username', 'email']): UserInterface
    {
        foreach ((array)$fields as $field) {
            if ($field === 'key') {
                $user = $this->get($query);
            } elseif ($field === 'storage_key') {
                $user = $this->withKeyField('storage_key')->get($query);
            } elseif ($field === 'flex_key') {
                $user = $this->withKeyField('flex_key')->get($query);
            } elseif ($field === 'email') {
                $user = $this->withKeyField('email')->get($query);
            } elseif ($field === 'username') {
                $user = $this->get(mb_strtolower($query));
            } else {
                $user = $this->__call('find', [$query, $field]);
            }
            if ($user) {
                return $user;
            }
        }

        return $this->load('');
    }
919329
public function findFilterDataBySlug(Query $query, array $options)
    {
        if (!isset($options['request']) || get_class($options['request']) !== ServerRequest::class) {
            user_error('The request query option must exist and must be of type Cake\Http\ServerRequest.');
        }

        $encryptedFilterData = $this->_findEncryptedFilterData($query, $options['request'])->first();

        if ($encryptedFilterData) {
            $encryptedFilterData = $encryptedFilterData->toArray();
            return $this->_decodeFilterData($encryptedFilterData['filter_data']);
        }

        return [];
    }
192178
public function getList(array $query = [])
    {
        $resource = self::DOMUSERP_API_OPERACIONAL . '/' . $this->cityId .'/bairros';
        $list = $this->pagination($resource);

        return $list;
    }