bentools/doctrine-watcher-bundle
EventDispatcher) or CQRS patterns for complex workflows.doctrine.orm.events or symfony.event_dispatcher?App\Entity\UserProfile) to test configuration and callback behavior.prePersist, preUpdate) with the bundle’s property-level watchers.stof/doctrine-extensions).BookWatcher) are PSR-4 autoloaded.composer require bentools/doctrine-watcher-bundle:^1.0
config/packages/doctrine_watcher.yaml.# config/packages/doctrine_watcher.yaml
doctrine_watcher:
watch:
App\Entity\Book:
properties:
title:
callback: 'App\Services\BookWatcher::onTitleChange'
// src/Services/BookWatcher.php
namespace App\Services;
class BookWatcher {
public function onTitleChange($title, $entity) { ... }
public function onReviewsChange(array $reviews, $entity) { ... }
}
EntityManager mocks.null values, empty arrays).use Psr\Log\LoggerInterface;
class BookWatcher {
public function __construct(private LoggerInterface $logger) {}
public function onTitleChange($title) {
$this->logger->info('Title changed to', ['title' => $title]);
}
}
save() operations. Benchmark with:
How can I help you explore Laravel packages today?