{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/7839","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/7839/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/7839/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/7839/events","html_url":"https://github.com/yiisoft/yii2/issues/7839","id":63674484,"number":7839,"title":"Чем не угодил обычный namespace???","user":{"login":"exru","id":5754949,"avatar_url":"https://avatars.githubusercontent.com/u/5754949?v=3","gravatar_id":"","url":"https://api.github.com/users/exru","html_url":"https://github.com/exru","followers_url":"https://api.github.com/users/exru/followers","following_url":"https://api.github.com/users/exru/following{/other_user}","gists_url":"https://api.github.com/users/exru/gists{/gist_id}","starred_url":"https://api.github.com/users/exru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exru/subscriptions","organizations_url":"https://api.github.com/users/exru/orgs","repos_url":"https://api.github.com/users/exru/repos","events_url":"https://api.github.com/users/exru/events{/privacy}","received_events_url":"https://api.github.com/users/exru/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:need%20more%20info","name":"status:need more info","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-03-23T09:21:41Z","updated_at":"2015-03-23T10:08:11Z","closed_at":null,"body":"```html\r\nCannot redeclare class backend\\models\\Pages\r\n1. in /var/www/sp2/backend/models/Pages.php at line 74\r\n65666768697071727374     */\r\n    public function getPages()\r\n    {\r\n        return $this->hasMany(Pages::className(), ['pid' => 'id']);\r\n    }\r\n \r\n    public function getFullUrl(){\r\n        var_dump(Yii::$app->db->createCommand(\"select * from pages\")->queryAll());\r\n    }\r\n}\r\n2. yii\\base\\ErrorHandler::handleFatalError()\r\n````\r\n```php\r\n<?php\r\n//namespace app\\models; //было \r\nnamespace backend\\models; //стало\r\n\r\nuse Yii;\r\n\r\nclass Pages extends \\yii\\db\\ActiveRecord\r\n{\r\n    /**\r\n     * @inheritdoc\r\n     */\r\n    public static function tableName()\r\n    {\r\n        return 'pages';\r\n    }\r\n\r\n    /**\r\n     * @inheritdoc\r\n     */\r\n    public function rules()\r\n    {\r\n        return [\r\n            [['url', 'name', 'description'], 'required'],\r\n            [['url'], 'unique'],\r\n            [['url'], 'match', 'not' => true, 'pattern'=>'/[^a-zA-Z0-9\\-\\_]+/', 'message'=>Yii::t('pages','URL must be contain only latin characters numbers and simbols _ -')],\r\n            \r\n            [['pid'], 'integer'],\r\n            [['description'], 'string'],\r\n            [['date'], 'safe'],\r\n            [['date'], 'date'],\r\n            [['enabled'], 'boolean'],\r\n            [['url', 'title', 'keywords', 'content', 'name'], 'string', 'max' => 255]\r\n        ];\r\n    }\r\n\r\n    /**\r\n     * @inheritdoc\r\n     */\r\n    public function attributeLabels()\r\n    {\r\n        return [\r\n            'id' => Yii::t('pages', 'id'),\r\n            'pid' => Yii::t('pages', 'pid'),\r\n            'url' => Yii::t('pages', 'url'),\r\n            'title' => Yii::t('pages', 'title'),\r\n            'keywords' => Yii::t('pages', 'keywords'),\r\n            'content' => Yii::t('pages', 'content'),\r\n            'name' => Yii::t('pages', 'name'),\r\n            'description' => Yii::t('pages', 'description'),\r\n            'date' => Yii::t('pages', 'date'),\r\n            'enabled' => Yii::t('pages', 'enabled'),\r\n        ];\r\n    }\r\n\r\n    /**\r\n     * @return \\yii\\db\\ActiveQuery\r\n     */\r\n    public function getP()\r\n    {\r\n        return $this->hasOne(Pages::className(), ['id' => 'pid']);\r\n    }\r\n\r\n    /**\r\n     * @return \\yii\\db\\ActiveQuery\r\n     */\r\n    public function getPages()\r\n    {\r\n        return $this->hasMany(Pages::className(), ['pid' => 'id']);\r\n    }\r\n    \r\n    public function getFullUrl(){\r\n        //var_dump(Yii::$app->db->createCommand(\"select * from pages\")->queryAll());\r\n    }\r\n}\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/84927104","html_url":"https://github.com/yiisoft/yii2/issues/7839#issuecomment-84927104","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/7839","id":84927104,"user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"created_at":"2015-03-23T10:08:10Z","updated_at":"2015-03-23T10:08:10Z","body":"Я понятия не имею, как такое получилось. Попробуйте воспроизвести на чистом приложении, станет понятней."}}