{"action":"opened","issue":{"url":"https://api.github.com/repos/consultnn/yii2-behaviors/issues/1","repository_url":"https://api.github.com/repos/consultnn/yii2-behaviors","labels_url":"https://api.github.com/repos/consultnn/yii2-behaviors/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/consultnn/yii2-behaviors/issues/1/comments","events_url":"https://api.github.com/repos/consultnn/yii2-behaviors/issues/1/events","html_url":"https://github.com/consultnn/yii2-behaviors/issues/1","id":153670770,"number":1,"title":"Deprecate AttributeTypeBehavior","user":{"login":"serieznyi","id":2323142,"avatar_url":"https://avatars.githubusercontent.com/u/2323142?v=3","gravatar_id":"","url":"https://api.github.com/users/serieznyi","html_url":"https://github.com/serieznyi","followers_url":"https://api.github.com/users/serieznyi/followers","following_url":"https://api.github.com/users/serieznyi/following{/other_user}","gists_url":"https://api.github.com/users/serieznyi/gists{/gist_id}","starred_url":"https://api.github.com/users/serieznyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serieznyi/subscriptions","organizations_url":"https://api.github.com/users/serieznyi/orgs","repos_url":"https://api.github.com/users/serieznyi/repos","events_url":"https://api.github.com/users/serieznyi/events{/privacy}","received_events_url":"https://api.github.com/users/serieznyi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/consultnn/yii2-behaviors/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-08T18:38:05Z","updated_at":"2016-05-08T18:38:05Z","closed_at":null,"body":"Я начинаю сомневаться в целесообразности использования AttributeTypeBehavior.\r\nПросто все те же операции можно сделать и с помощью обычных правил Yii2.\r\nНапример: \r\n\r\n1) Приведение к простому типу \r\n`[\"status\", \"filter\" => function($value){return (int) $value;}]`\r\n\r\n2) Приведение к MongoId\r\n`[\"user_id\", \"filter\" => function($value){return \\MongoId($value);}]`\r\n\r\n3) Приведение к массиву MongoId\r\n```\r\n[\r\n\"rubric_ids\",\r\n    \"filter\" => function($ids){\r\n        return array_map(\r\n            function($id){return \\MongoId($id);},\r\n            $ids\r\n        );\r\n    }\r\n]\r\n```\r\n\r\nЕдинственный плюс, который я вижу в этом поведении - приведение к нужному типу по правилам валидации полей. Но я не уверен, что ради этого стоит его использовать. \r\nЧто вы думаете? "}}