{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/135","repository_url":"https://api.github.com/repos/yiisoft/yii2-queue","labels_url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/135/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/135/events","html_url":"https://github.com/yiisoft/yii2-queue/issues/135","id":257620071,"number":135,"title":"Теряется метод класса","user":{"login":"maxim-kn-akvilon","id":28655074,"avatar_url":"https://avatars2.githubusercontent.com/u/28655074?v=4","gravatar_id":"","url":"https://api.github.com/users/maxim-kn-akvilon","html_url":"https://github.com/maxim-kn-akvilon","followers_url":"https://api.github.com/users/maxim-kn-akvilon/followers","following_url":"https://api.github.com/users/maxim-kn-akvilon/following{/other_user}","gists_url":"https://api.github.com/users/maxim-kn-akvilon/gists{/gist_id}","starred_url":"https://api.github.com/users/maxim-kn-akvilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxim-kn-akvilon/subscriptions","organizations_url":"https://api.github.com/users/maxim-kn-akvilon/orgs","repos_url":"https://api.github.com/users/maxim-kn-akvilon/repos","events_url":"https://api.github.com/users/maxim-kn-akvilon/events{/privacy}","received_events_url":"https://api.github.com/users/maxim-kn-akvilon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-14T07:23:52Z","updated_at":"2017-09-14T11:10:11Z","closed_at":null,"author_association":"NONE","body":"У меня есть несколько условий с запросами в бд, при которых я делаю отправку нотификации в телефон\r\n\r\nДелаю это через такой код\r\n```\r\nclass ChangeNotification\r\n{\r\n    const NOTIFICATION_TYPES = [\r\n        Stage::class,\r\n        InList::class,\r\n    ];\r\n\r\n    public static function run(Model $model, NotificationService $notificationService)\r\n    {\r\n        foreach (self::NOTIFICATION_TYPES as $class) {\r\n            /**\r\n             * @var NotificationTypeInterface $obj\r\n             */\r\n            $obj = new $class($model, $notificationService);\r\n            if ($obj->needSendNotification()) {\r\n                if ($relation = $model->relation) {\r\n                    $relation->inactive();//$relation->status = 1; $relation->save();\r\n                }\r\n                return $obj->sendNotification();\r\n            }\r\n        }\r\n        return [];\r\n    }\r\n}\r\n```\r\nОднако получается так, что когда я вызываю ChangeNotification::run($model, $notificationService) без использования очереди у меня код всегда срабатывает. Но когда закидываю в очередь, то у меня возникает ошибка\r\n```\r\n#0 yii\\base\\ErrorException: Trying to get property of non-object in /var/www/project/api/notification/types/Stage.php:73\r\n\r\n#1 /var/www/project/api/notification/ChangeNotification.php(50): api\\notification\\types\\Stage->sendNotification()\r\n```\r\nМетод в классе прописан, объект создан, первое условие срабатывает и возвращает (bool) true.\r\nКогда исполняется скрипт по InList::class все работает\r\nНо на Stage::class получается вот такой краш\r\n\r\n\r\nВ чем может быть проблема?\r\n\r\nПараметры подключения компонента queue:\r\ncommon/config/main.php\r\n```\r\n'bootstrap' => [\r\n        'notificationQueue', // The component registers own console commands\r\n    ],\r\n```\r\ncommon/main-local.php\r\n```\r\n 'components' => [\r\n        'notificationQueue' => [\r\n            'class' => \\yii\\queue\\amqp\\Queue::class,\r\n            'as log' => \\yii\\queue\\LogBehavior::class,\r\n            'queueName' => 'notificationQueue',\r\n            'serializer' => \\yii\\queue\\serializers\\PhpSerializer::class,\r\n            'ttr' => 5 * 60,\r\n            'attempts' => 3,\r\n            'user' => 'user',\r\n            'password' => 'pass',\r\n            // Other driver options\r\n        ],\r\n```\r\n\r\nСпособ становления в очередь:\r\n```\r\nYii::$app->notificationQueue->push(new ChangeNotificationJob(['modelId' => $model->id], $this->notificationService));\r\n```\r\n\r\nКласс ChangeNotificationJob:\r\n\r\n```\r\nclass ChangeNotificationJob extends Object implements Job\r\n{\r\n    public $modelId;\r\n    private $notificationService;\r\n\r\n    public function __construct(array $config = [], NotificationService $notificationService)\r\n    {\r\n        parent::__construct($config);\r\n        $this->notificationService = $notificationService;\r\n    }\r\n\r\n    public function execute($queue)\r\n    {\r\n        ChangeNotification::run(Model::findOne($this->modelId), $this->notificationService);\r\n    }\r\n}\r\n```\r\n\r\nИнформация о системе:\r\n\r\nUbuntu 16.04\r\nYii 2.0.12\r\nPHP 7.1"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/comments/329450288","html_url":"https://github.com/yiisoft/yii2-queue/issues/135#issuecomment-329450288","issue_url":"https://api.github.com/repos/yiisoft/yii2-queue/issues/135","id":329450288,"user":{"login":"dmirogin","id":5470439,"avatar_url":"https://avatars2.githubusercontent.com/u/5470439?v=4","gravatar_id":"","url":"https://api.github.com/users/dmirogin","html_url":"https://github.com/dmirogin","followers_url":"https://api.github.com/users/dmirogin/followers","following_url":"https://api.github.com/users/dmirogin/following{/other_user}","gists_url":"https://api.github.com/users/dmirogin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmirogin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmirogin/subscriptions","organizations_url":"https://api.github.com/users/dmirogin/orgs","repos_url":"https://api.github.com/users/dmirogin/repos","events_url":"https://api.github.com/users/dmirogin/events{/privacy}","received_events_url":"https://api.github.com/users/dmirogin/received_events","type":"User","site_admin":false},"created_at":"2017-09-14T11:10:11Z","updated_at":"2017-09-14T11:10:11Z","author_association":"MEMBER","body":"А что у вас тут  /var/www/project/api/notification/types/Stage.php:73"}}
{"actor":{"display_login":"dmirogin"}}