Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm having problem with logging in. So can I put my comment here?
- I just want to add example for the autocompletion especially about
- CWebApplication component injection. Although I'm still not sure
- enough if this is important enough to be in the new Yii NB Plugin.
- The nice thing I like about Yii is that I can easily add component
- in the CWebApplication from the config (/protected/config/main.php.
- this is the default config file for production)
- e.g.
- <?php
- //CONFIG #1
- return array(
- //cut
- 'components' => array(
- 'user' => array(
- 'allowAutoLogin' => true,
- )
- )
- //cut
- );
- the current Netbeans can detect the App singleton in Yii class,
- although it only detects the singleton as CApplication instead of
- CWebApplication (if I code it for the web endpoint not console).
- It will be nice if the NB can do autocomplete for the 'component' config.
- Let's say if I had the config #1 above, and I type `Yii::app()->us`
- it can complete to `Yii::app()->user` and knows that `Yii::app()->user`
- is the default CWebUser (see [1] and [2])
- And what's really nice about the `component` part in the config, I can
- change the class for `user` component.
- <?php
- //CONFIG #2
- return array(
- //cut
- 'components' => array(
- 'user' => array(
- 'class' => 'MyWebUser',
- 'allowAutoLogin' => true,
- )
- )
- //cut
- );
- So, if I type `Yii::app()->user`, it would be nice if NetBeans could
- know if the `user` field is an instance of `MyWebUser`.
- Another thing is, as I mentioned above, that I can add custom component
- to `Yii::app()` singleton.
- <?php
- //CONFIG #3
- return array(
- //cut
- 'components' => array(
- 'myComponent' => array(
- 'class' => 'MyComponentClass',
- )
- )
- //cut
- );
- This is not the default `CWebApplication` components as stated in [1],
- but this is what I really like from Yii. I can just call my component
- by `Yii::app()->myComponent`. And it would be nice if NetBeans could
- know if the `myComponent` is an instance of `MyComponentClass`.
- Again, I'm not sure if it's important enough for everyone else and
- I'm already getting used to it. But I'm just suggesting. :)
- [1] http://www.yiiframework.com/doc/api/1.1/CWebApplication
- [2] https://github.com/yiisoft/yii/blob/1.1.12/framework/web/CWebApplication.php#L208
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement