コード例 #1
0
ファイル: Product.php プロジェクト: savvagee/thelia
 public function addAccessory(ProductAddAccessoryEvent $event)
 {
     if (AccessoryQuery::create()->filterByAccessory($event->getAccessoryId())->filterByProductId($event->getProduct()->getId())->count() <= 0) {
         $accessory = new Accessory();
         $accessory->setDispatcher($event->getDispatcher())->setProductId($event->getProduct()->getId())->setAccessory($event->getAccessoryId())->save();
     }
 }