Skip to content

FilteredBehavior and CakePHP 2.3.x #10

@Fluit

Description

@Fluit

CakePHP v2.3, PHP v5.4

The FilteredBehavior returns an empty $query['conditions']-array.
A little research learned me this:

function beforeFind(Model $Model, $query)
{
...
$settings = $this->settings[$Model->alias];
$values = $this->_filterValues[$Model->alias];

    foreach ($settings as $field => $options)
    {
        $this->addFieldToFilter($Model, $query, $settings, $values, $field, $options); 
    }

    ...
    return $query;
}

Inhere, the methodcall
$this->addFieldToFilter($Model, $query, $settings, $values, $field, $options); returns an empty $query['conditions']-array.

Some new investigations:

protected function buildFilterConditions(array $query, $field, $options, $value)
{
...

}

The method creates the $query['conditions'] well, but after the transfer to beforeFind, it is empty. The only place where the $query['conditions']-array is properly set is after switch{ ... }.

any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions