ddd
ddd copied to clipboard
mostRecentPublishedMessageId() returns the first PublishedMessageId instead of the last
In the class Ddd\Infrastructure\Application\Notification\DoctrinePublishedMessageTracker on line 18 the code should be replaced with: $messageTracked = $this->findOneBy(array('typeName'=>$aTypeName), array('trackerId'=>'DESC')); in order to return the last PublishedMessageId
That's not needed due typeName
is unique in PublishedMessageTracker
table.
The goal is track only the last id
per typeName
not the history of tracks.
OK, but if that's the design, then there is a problem with the class Ddd\Infrastructure\Application\Notification\DoctrinePublishedMessageTracker on the line 39 where the $publishedMessage = $this->find($aTypeName); method never finds the PublishedMessage object in the repository and always creates a new one in the persistence and the result is multiple records for one typeName in the event_published_message_tracker table. The find method expects the primary key and not the $aTypeName.