Ejemplo n.º 1
0
 /**
  * Handle the deletion of a MetaModel and all attached data.
  *
  * @param PreDeleteModelEvent $event The event.
  *
  * @return void
  */
 public function handleDelete(PreDeleteModelEvent $event)
 {
     if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel') {
         return;
     }
     $factory = $this->getServiceContainer()->getFactory();
     $metaModel = $factory->getMetaModel($factory->translateIdToMetaModelName($event->getModel()->getId()));
     if ($metaModel) {
         $this->destroyAttributes($metaModel);
         $this->destroyDcaCombinations($metaModel);
         $this->destroyInputScreens($metaModel);
         $this->destroyRenderSettings($metaModel);
         $this->destroyFilterSettings($metaModel);
         TableManipulation::deleteTable($metaModel->getTableName());
     }
 }
Ejemplo n.º 2
0
 /**
  * Handle the deletion of an attribute and all attached data.
  *
  * @param PreDeleteModelEvent $event The event.
  *
  * @return void
  */
 public function handleDeleteAttribute(PreDeleteModelEvent $event)
 {
     if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_attribute') {
         return;
     }
     $attribute = $this->createAttributeInstance($event->getModel()->getPropertiesAsArray());
     if ($attribute) {
         $attribute->destroyAUX();
     }
 }
Ejemplo n.º 3
0
 /**
  * Handle the deletion of a MetaModel and all attached data.
  *
  * @param PreDeleteModelEvent $event The event.
  *
  * @return void
  */
 public function handleDelete(PreDeleteModelEvent $event)
 {
     if ($event->getModel()->getProviderName() !== 'tl_metamodel') {
         return;
     }
     $factory = $this->getServiceContainer()->getFactory();
     $metaModel = $factory->getMetaModel($factory->translateIdToMetaModelName($event->getModel()->getId()));
     if ($metaModel) {
         TableManipulation::deleteTable($metaModel->getTableName());
     }
 }