I have created a code to send notifications to users. I want to do it automatically through cron. To have this done, I have created a console controller. When trying to launch it I get the following exception:
2015-07-13 12:19:53 [-][-][-][error][yii\base\UnknownPropertyException] exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: yii\console\Request::url' in C:\xampp\htdocs\appname\vendor\yiisoft\yii2\base\Component.php:143
What’s wrong with the console/swiftmailer config? The same code works perfectly fine when requested through regular webcontroller…
I just came across this issue. It looks like url is only used to generate the $filterUrl. In your gridview, if like me you are rendering this to go in an email for filters are not required, the add filterUrl to your Gridview config:
This property is still required, even when filterModel is null (looks like a bug to me - I will do a fix when I get time).
I would guess the next issues you hit are due to Gridview thinks it needs assets (looks like it does not if sorting and filtering are not used). I fixed this by setting the @web alias before calling renderPartial:
Why would one use GridView in an email template? None of the features it offers (pagination, filtering, sorting, AJAX) work in email context and it causes much more problems than it solves. A HTML table can be generated with a foreach loop and a few lines of HTML code in your email templates.