/** * Handle the paste into and after event. * * @param PostDuplicateModelEvent $event The event. * * @return void */ public function handle(PostDuplicateModelEvent $event) { $model = $event->getModel(); $metaModel = $this->getServiceContainer()->getFactory()->getMetaModel($model->getProviderName()); if (!$metaModel || !$metaModel->hasVariants()) { return; } // Set the vargroup to null for auto creating. $model->setProperty('vargroup', null); }
/** * Retrieve the arguments for the callback. * * @param PostDuplicateModelEvent $event The event being emitted. * * @return array */ public function getArgs($event) { return array($event->getModel()->getId(), new DcCompat($event->getEnvironment(), $event->getSourceModel())); }