ddd icon indicating copy to clipboard operation
ddd copied to clipboard

mostRecentPublishedMessageId() returns the first PublishedMessageId instead of the last

Open dadeky opened this issue 8 years ago • 2 comments

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

dadeky avatar Aug 12 '16 12:08 dadeky

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.

martinezdelariva avatar Aug 12 '16 14:08 martinezdelariva

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.

dadeky avatar Aug 16 '16 09:08 dadeky