-
Notifications
You must be signed in to change notification settings - Fork 69
Wrong namespace in "Introducing the Blog Module" #109
Comments
Yes. |
@webimpress bad example for question :) Ok, take other controller: |
The choice is yours: it's a framework, and you can choose the option that you prefer and that works for you. One option is to create an alias: use Album\Model\Album;
use Album\Controller\Album as AlbumController;
$model = new Album();
$controller = new AlbumController(); Or import the namespace: use Album\Model\Album;
use Album\Controller;
$model = new Album();
$controller = new Controller\Album(); Or use a postifx: use Album\Model\Album;
use Album\Controller\AlbumController;
$model = new Album();
$controller = new AlbumController(); |
yes, but i cant find other cases in tutorials + I recently started learning ZF. I don't know what problems may arise in other cases. maybe its alias for extending in application/other modules :) |
We tend to use suffixes within the examples for several reasons:
As others have noted, you can achieve some of the same effects by using aliasing when importing classes. Ultimately, the choice of how you organize the code is up to you and your team. Our goals in creating tutorials are to make clear what class does what, and we have chosen suffixing generally to meet that goal. |
@weierophinney pls, add this at begin tutorials, because
yes, but i cant see this in tutorials
its not only tutorial practice |
i try say: make tutorial more transparent for beginners. traditions are good, but without explanation they only lead to copying without understanding the meaning. |
Missing directory
Controller
:Blog\Controller\ListController::indexAction
.Also i dont understand why classes use postfix
Controller
? Does usingBlog\Controller\List
add any problems?/tutorials/in-depth-guide/first-module/
The text was updated successfully, but these errors were encountered: