oncesk / yii-node-socket

66 stars 46 forks source link

Send frames from console application #67

Open paulobrandit opened 9 years ago

paulobrandit commented 9 years ago

Hello there oncesk, On a yii 1.1 project, I need to have a cron running daily checking the db if there are expiring contracts and if so, I need to notify the users logged in. I created a console application for that but, when I try to create an event frame, I always get an error because CConsoleApplication does not have Session property (obviously).

exception 'CException' with message 'Property "CConsoleApplication.session" is not defined.' in /Applications/MAMP/htdocs/yii/framework/base/CComponent.php:130 Stack trace:

0 /Applications/MAMP/htdocs/yii/framework/base/CModule.php(105): CComponent->__get('session')

1 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/AFrame.php(240): CModule->__get('session')

2 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/AFrame.php(49): YiiNodeSocket\Frames\AFrame->_createContainer()

3 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/FrameFactory.php(32): YiiNodeSocket\Frames\AFrame->__construct(Object(NodeSocket))

Is there an easy to overpass this? Any suggestions?

Thank you so much, Kind Regards, Paulo.

oncesk commented 9 years ago

Hi, maybe create dummy session, implement yii session interface create component

Maybe something like this...

Отправлено с моего Xiaomi

Сообщение от "paulobrandit notifications@github.com":

Hello there oncesk, On a yii 1.1 project, I need to have a cron running daily checking the db if there are expiring contracts and if so, I need to notify the users logged in. I created a console application for that but, when I try to create an event frame, I always get an error because CConsoleApplication does not have Session property (obviously).

exception 'CException' with message 'Property "CConsoleApplication.session" is not defined.' in /Applications/MAMP/htdocs/yii/framework/base/CComponent.php:130 Stack trace:

0 /Applications/MAMP/htdocs/yii/framework/base/CModule.php(105): CComponent->__get('session')

1 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/AFrame.php(240): CModule->__get('session')

2 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/AFrame.php(49): YiiNodeSocket\Frames\AFrame->_createContainer()

3 /Applications/MAMP/htdocs/starsandfriends/protected/extensions/yii-node-socket/lib/php/frames/FrameFactory.php(32): YiiNodeSocket\Frames\AFrame->__construct(Object(NodeSocket))

Is there an easy to overpass this? Any suggestions?

Thank you so much, Kind Regards, Paulo.

— Reply to this email directly or view it on GitHub.