Errata

Home Forums Learn ZF2 Errata

Tagged: 

This topic contains 14 replies, has 4 voices, and was last updated by  Slavey Karadzhov 2 years, 1 month ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #345

    ideocentric
    Participant

    First off… This is a wonderful book, and thank you for writing.

    I believe on page 67 the current paragraph reads:

    …filename module/User/src/Form/User.php

    This should be:

    …filename module/User/src/User/Form/User.php

    In the following segment for form creation.. I believe that the inconsistency in conventions for setting the attribute for required is unclear. In one case the attribute for email is as follows:

    ‘required’ => true,

    whereas in all the remaining form elements the required attribute is set by the following:

    ‘required’ => ‘required’,

    I am uncertain if they are essentially equivalent or that the different elements require a different syntax. If the later is the case, then I believe that this should be documented more completely.

    —-

    On page 76 the book begins to redefine the the addAction in the controller. However, the controller is previously defined in the book as:

    class AccountController extends AbstractActionController

    not as:

    class UserController extends AbstractActionController

    which is listed on page 76. The example file stored on git defines this as AccountController and not UserController.

    • This topic was modified 2 years, 11 months ago by  ideocentric.
    #348

    Slavey Karadzhov
    Participant

    Hi ideocentric,
    Thanks a lot your valuable feedback.

    > …filename module/User/src/Form/User.php
    I added this to the things we should fix in the next version.

    > ‘required’ => true, … ‘required’ => ‘required’,
    You are right. For better consistency we should fix this too.

    > I am uncertain if they are essentially equivalent or that the different elements require a different syntax
    “required” is HTML 5 attribute (http://www.w3schools.com/tags/att_input_required.asp ). For the moment as far as I can see from the documentation “required” => “<something>” is enough to set this attribute.

    > On page 76 the book begins to …
    I have to check that. But I guess you’ve found one more issue.

    Thanks a lot for reporting this and if you find something more feel free to add it to this post.

    Regards,
    Slavey

    #353

    Slavey Karadzhov
    Participant

    Hi ideocentric, the issues that you’ve reported are fixed and part of the new Kindle version of the book. Thanks again for your help!

    #645

    ArteQ
    Participant

    Page 50, bottom of the page, code example:

    if ($instance instanceof use AdapterAwareInterface) {

    I don’t think we really need this use there 🙂

    #648

    Slavey Karadzhov
    Participant

    Nice catch! Thanks a lot ArteQ.

    #684

    Hi Slavey: As a beginner to ZF2 I find this book challenging but at the same time more rewarding. I know it is not an error, but not sure if I got this right:
    The module events (const in ModuleMangerModuleEvent.php) occur in the order as described on page 25 regarding preparation phase:
    EVENT_LOAD_MODULES
    EVENT_LOAD_MODULE_RESOLVE
    EVENT_LOAD_MODULE (init method called)
    EVENT_MERGE_CONFIG
    EVENT_LOAD_MODULES_POST
    (added MERGE, http://framework.zend.com/manual/current/en/modules/zend.module-manager.module-manager.html)
    So the function loadedModulesInfo occurs when function init runs so it can listen for future events, like EVENT_MERGE_CONFIG and EVENT_LOAD_MODULES_POST. Initially I didn’t understand why EVENT_LOAD_MODULE_RESOLVE produced no log.

    Then in loadedModulesInfo, functions from ModuleMangerModuleManager.php can be used when the event is triggered.

    Small error: Your code on GIT has ‘loadModules.post’ rather than what is in the book, showing constant ModuleEvent::EVENT_LOAD_MODULES_POST which is the preferred format as I have learned from you.

    #685

    Slavey Karadzhov
    Participant

    Hi John,
    > Small error: Your code on GIT has ‘loadModules.post’ rather than what is in the book, showing constant ModuleEvent::EVENT_LOAD_MODULES_POST which is the preferred format as I have learned from you.
    Thanks for noticing this. I fixed it some minutes ago in the official github repository.

    > The module events (const in ModuleMangerModuleEvent.php) occur in the order as described on page 25 regarding preparation phase:
    Looks like something to improve in the book. I can try to explain in the book the case that you had and add reasoning why you can attach a listen to EVENT_LOAD_MODULES_POST that will work. I will it to my TODO list.

    John, is there something else that you can recommend for improving the book?

    #686

    Page 35 function handleError(
    $controller = $event->getController(); //code not used
    When I include it nothing is returned.
    Note: It would be good to have an error here where $event->getParam(‘exception’) is not null.

    #687

    Page 37-38: For the beginner to ZF2 this “channel” example is difficult to comprehend without a working example. I am looking at http://framework.zend.com/manual/current/en/tutorials/tutorial.eventmanager.html I know it comes up later, so I may skip it and wait until page 132.

    #688

    Page 44: I expected the code on page 44 which includes a call to the serviceLocator, to be in the ch-service-timer code (also missing from ch-service-time-calculation). However more importantly, that code does not include a working example. I realize you have “Using Services” on page 51 and that is the code you need for a working example so it is coming later. Also I think when the critic from Amazon.com was referring to the example code and book being out of sync, he was looking at page 46 where you begin to describe the abstractfactory service. Good explanation, but I expected that to be part of sample code. I like to see a working example of anything presented. For an exercise, I will try to get TimerAbstractFactory.php working. Thanks.

    #691

    Slavey Karadzhov
    Participant

    John, thanks a lot for the remarks. Just for my understanding can you tell me if you refer to the paper version of the book of one of e-versions(Kindle, EPUB, PDF)?

    > Page 35 function handleError(
    $controller = $event->getController(); //code not used

    Sounds like a bug to me. I will take a look at that later today and fix it.

    > Page 37-38: For the beginner to ZF2 this “channel” example is difficult to comprehend without a working example.

    I will see if I can add a small example or directly refer to existing example further in the book.

    > For an exercise, I will try to get TimerAbstractFactory.php working.
    The TimerAbstractFactory was added later, but it was never really used in the code. I have to think about a simple and sane usage of abstract factories in the book that does not lead to big change in the source code…

    Thanks again for the hints. If you have suggestions for source code or text changes for the above issues, please let me know.

    #692

    I am using Kindle (most recent) edition.
    Page 58, 13.3 Layout
    This would not work. However easy enough to figure out. Just searched your site and found: http://learnzf.com/view-models-and-rendering-demystified/
    With ViewModel, it worked. Incidentally, the example that followed that used EVENT_RENDER – I found it excellent. Thanks.

    #693

    Slavey Karadzhov
    Participant

    > This would not work.
    John, can you explain with more details what do you think won’t work?

    #694

    Referring to “class IndexController extends AbstractActionController”

    Don’t see what my problem was now. I thought I needed the ViewModel but it worked just fine without it. I understand you used the word ’embedded’ as an example since you ’embed’ the template. So I just substituted the existing layout ‘sidebar’ and it worked fine:
    $this->layout()->setTemplate(‘debug/layout/sidebar’);

    However, while we are here, the function addDebugOverlay (Our “Top Line”, “Bottom Lind”) is run for all pages. Wouldn’t we want it to run just when there is an error? I guess I don’t fully understand what the intention of “For our Debug module we want to add a new layout around the existing one, and to show debug information.”

    #695

    Slavey Karadzhov
    Participant

    > However, .. function addDebugOverlay … is run for all pages.
    You understood that correctly. This function adds debug “frame” over our existing layout. And it will be used further in the book to help us display debug information. In the book you will see examples of showing the SQL profiler information.

    The beauty of all this is that when you disable the Debug module there will be no more debug messages shown on the screen and you do not have to refactor your code to be ready for the production servers.

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.