addDebugOverlay

Home Forums Learn ZF2 addDebugOverlay

Tagged: ,

This topic contains 10 replies, has 2 voices, and was last updated by  Anonymous Contributor 2 years, 11 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #524

    Trying to follow the book, hoping it would help me to work with ZF2.

    I am having difficulty to find the class file that you put the addDebugLayer event to create debug sidebar view. Chapter: View -> Layout (EPUB version, page 88)

    You explain how to create the event listener for EVENT_RENDER in Debug Module.php but have no clue where to locate the mentioned function. It might be me that confused so much for the last 4 hours without break but that would be great if you could lead me to the answer quickly.

    What is the file that Debug class is supposed to be saved it?

    Thanks.

    #526

    oh yes, I tried git checkout ‘ch-view’ and it did only reset whatever I accomplished so far and left me with blank screen with ‘Invalid callback provided; not callable’ error.

    I saw a comment about “not using” the codes from git for your book somewhere but somehow I tempted to test what if the comment was wrong. I was wrong.

    #527

    Sorry but I have to say this: It is a mistake in the book.

    addDebugOverlay is actually located in the Module class in Module.php, there is nothing to do with a class called “Debug” as stated in the book in the latest version I purchased yesterday.

    Don’t get me wrong, I am able to follow your book very well, I am learning a lot which I was not even able to start with others’. And thank you very much. But this one basically costed my 2 hours.

    I hope this info helps others and correcting it in your book.

    #532

    Slavey Karadzhov
    Participant

    Hi smozgur,
    Can you tell me the page number and the sentence(s) that states this? We will fix it in the next Kindle version and add it to the queue for the paper version.

    Thanks in advance for your valuable feedback.

    Regards,
    Slavey

    #533

    In page 67, you start code section with:
    “And the callback will add an overlay to the existing layout, without the need to know the original
    layout.”

    Then your listing for the class module code states the class is named as Debug – also doesn’t mention which file, which was my original question if you read carefully.

    In the actual code addDebugOverlay method is in the Module class.

    Hope this helps.

    #535

    Slavey Karadzhov
    Participant

    > Then your listing for the class module code states the class is named as Debug

    There is a sentence saying:

    “In the Debug Module.php we will attach a listener to the dispatch event:”.

    Is it ok if I just add the path to the file?

    “In the Module.php file (module/Debug/Module.php) from the Debug module we will attach a listener to the dispatch event:”. I am open for suggestions.

    #536

    You just need to correct the class name in the actual class file code listing just in the next page of that sentence which explains where to attach the listener.

    Ok, it currently looks like following:

    <?php
    namespace Debug;
    use Zend\View\Model\ViewModel;

    class Debug
    {
    public function addDebugOverlay(MvcEvent $event)

    “class Debug;” is suppose to be “Class Module;”. According to your sample project files and according to myself after 5 days ZF2 experience.

    I can find it out now easier, but a new ZF2 reader, just like myself 5 days ago, might spend some time to auto-correct that wrong class name in the listing. Or may be I am not that good. But I thought that you might want to hear about this.

    Hope it helps.

    #537

    Slavey Karadzhov
    Participant

    > You just need to correct the class name in the actual class file
    Thanks a lot Smozgur! This last post explains it all. In the coming weeks I will send you a revised epub version.

    #538

    Glad to hear it helps!

    Again, nice work. I paused for a while to make some exercises with what I learned so far but I’ll keep continue following your chapters. Do you want me to let you know if I find anything else?

    Have a great day!

    #539

    Slavey Karadzhov
    Participant

    > Do you want me to let you know if I find anything else?
    Yes, please. Don’t hesitate to let me know if you find something. You can write directly to my email (given in the initial pages of the book).Thanks to helpful readers and reviewers like you we can make together the book better and more useful. And using modern methods we can publish the changes relatively fast without the need to wait a year or two to see the revised version. Isn’t that great 🙂 ?

    #540

    It certainly is!

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

You must be logged in to reply to this topic.