public function addContent(ProductAddContentEvent $event) { if (ProductAssociatedContentQuery::create()->filterByContentId($event->getContentId())->filterByProduct($event->getProduct())->count() <= 0) { $content = new ProductAssociatedContent(); $content->setDispatcher($event->getDispatcher())->setProduct($event->getProduct())->setContentId($event->getContentId())->save(); } }