Difference between #1 and #2 of
My Own Components Folder in Yii2

Revision #2 has been created by CTala on May 6, 2014, 4:50:09 PM with the memo:

Fixing the code
« previous (#1)

Changes

Title unchanged

My Own Components Folder in Yii2

Category unchanged

Tips

Yii version unchanged

Tags unchanged

namespace, yii2, common, application component

Content changed

[...]
I am new with name spaces, so for me was a little difficult to understand it at the beginning.

In this case I was extending DbManager for it to be compatible with the information that I had from Yii1.0 for the Authorization. I needed this to be working in the same database that I had my old application, as I fully upgrade it.

The following is the result of a question asked in the forum in the followin link : [
Your text to link hereWiki Post...](http://www.yiiframework.com/forum/index.php/topic/53853-including-my-own-folder-of-components-in-the-namespace/ "Wiki Post") [list=1]
[*]Create the folder
[...]
The class that I created includes the namespace app\components on it.

[code]
 

 
 
 
```php

<?php
[...]
* @author ctala
*/
class MyDbManager extends DbManager {
.
 
[/code]
```
 


[*]Calling the Class
[...]
Now, in the ocnfiguration file I can call the class without troubles.

[code]
 
 
        
 
 
 
 
```php 
'authManager' => [ 'class' => '\app\components\MyDbManager', ],
 
[/code]
 
[/list]
```
 
 
 
 
And that's it. I hope that no one loose as much time as I did trying to do this.
2 1
2 followers
Viewed: 21 397 times
Version: 2.0
Category: Tips
Written by: CTala
Last updated by: CTala
Created on: May 6, 2014
Last updated: 10 years ago
Update Article

Revisions

View all history