{"action":"closed","issue":{"url":"https://api.github.com/repos/FriendsOfCake/search/issues/77","repository_url":"https://api.github.com/repos/FriendsOfCake/search","labels_url":"https://api.github.com/repos/FriendsOfCake/search/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfCake/search/issues/77/comments","events_url":"https://api.github.com/repos/FriendsOfCake/search/issues/77/events","html_url":"https://github.com/FriendsOfCake/search/issues/77","id":134879015,"number":77,"title":"Multiple values","user":{"login":"glafarge","id":670645,"avatar_url":"https://avatars.githubusercontent.com/u/670645?v=3","gravatar_id":"","url":"https://api.github.com/users/glafarge","html_url":"https://github.com/glafarge","followers_url":"https://api.github.com/users/glafarge/followers","following_url":"https://api.github.com/users/glafarge/following{/other_user}","gists_url":"https://api.github.com/users/glafarge/gists{/gist_id}","starred_url":"https://api.github.com/users/glafarge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glafarge/subscriptions","organizations_url":"https://api.github.com/users/glafarge/orgs","repos_url":"https://api.github.com/users/glafarge/repos","events_url":"https://api.github.com/users/glafarge/events{/privacy}","received_events_url":"https://api.github.com/users/glafarge/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FriendsOfCake/search/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-02-19T14:31:26Z","updated_at":"2016-09-20T08:04:44Z","closed_at":"2016-09-20T08:04:44Z","body":"What do you think about the support of multiple values ?\r\n\r\nFor example, if i need the following configuration : \r\n\r\n```php\r\n$this->addBehavior('Search.Search');\r\n$this->searchManager()\r\n    ->add('place', 'Search.Like', [\r\n        'before'=>true,\r\n        'after'=>true,\r\n        'field' => [$this->aliasField('ZipCode'), $this->aliasField('City')]\r\n]);\r\n```\r\n\r\nAs the Like filter only supports single value, I have created a child filter to supports arrays.\r\n\r\n```php\r\nnamespace App\\Model\\Filter;\r\n\r\nuse Cake\\ORM\\Query;\r\n\r\nclass LikeMultiple extends \\Search\\Model\\Filter\\Like\r\n{\r\n\r\n    /**\r\n     * Process a LIKE condition ($x LIKE $y).\r\n     * Allow multiple values\r\n     *\r\n     * @return void\r\n     */\r\n    public function process()\r\n    {\r\n        if ($this->skip()) {\r\n            return;\r\n        }\r\n\r\n        $conditions = [];\r\n        foreach ($this->fields() as $field) {\r\n            $left = $field . ' ' . $this->config('comparison');\r\n\r\n            if(is_array($this->value())) {\r\n                foreach($this->value() as $value) {\r\n                    $right = $this->_wildCards($value);\r\n                    $conditions[] = [$left => $right];\r\n                }\r\n            }\r\n            else {\r\n                $right = $this->_wildCards($this->value());\r\n                $conditions[] = [$left => $right];\r\n            }\r\n        }\r\n\r\n        $this->query()->andWhere([$this->config('mode') => $conditions]);\r\n    }\r\n}\r\n```\r\n\r\nI think we can add this functionnality to Like filter directly. This can be extended to Compare too.\r\nI can make a PR if needed.\r\n\r\nWhat do you think about it and about security concerns ?"}}
{"actor":{"display_login":"ADmad"}}