dddshelf / ddd-in-php-book-issues

Leave your comments, improvements or book mistakes as an issue! Thanks ❤️
https://leanpub.com/ddd-in-php
28 stars 2 forks source link

Wrong method call in Projector code example #68

Closed mattsches closed 7 years ago

mattsches commented 7 years ago

In the paragraph Synchronizing the Write Model with the Read Model (sorry, my ebook reader doesn't support page numbers), the method call $projection->eventType() does not adhere to the interface definition $projection->listensTo():

namespace Infrastructure\Projection;

class Projector
{
    //...
    public function register(array $projections)
    {
        foreach ($projections as $projection) {
            $this->projections[$projection->eventType()] = $projection;
            // should be $this->projections[$projection->listensTo()] = $projection;
        }
    }
    //...
}
carlosbuenosvinos commented 7 years ago

Thanks! You're now in the Acknowledgements.