/** * Delete an entity * * @param object $entity * * @return void */ public function deleteEntity($entity) { $this->getRepository()->nullVariantParent($entity->getId()); return parent::deleteEntity($entity); }
/** * {@inheritdoc} * * @param $entity */ public function deleteEntity($entity) { parent::deleteEntity($entity); //remove the column from the leads table $leadsSchema = $this->factory->getSchemaHelper('column', 'leads'); $leadsSchema->dropColumn($entity->getAlias()); $leadsSchema->executeChanges(); }
/** * @param Email $entity */ public function deleteEntity($entity) { if ($entity->isVariant() && $entity->getIsPublished()) { $this->resetVariants($entity); } parent::deleteEntity($entity); }
/** * {@inheritdoc} */ public function deleteEntity($entity) { parent::deleteEntity($entity); if (!$entity->getId()) { //delete the associated results table $schemaHelper = $this->factory->getSchemaHelper('table'); $schemaHelper->deleteTable("form_results_" . $entity->deletedId . "_" . $entity->getAlias()); $schemaHelper->executeChanges(); } }
/** * {@inheritdoc} * * @param $entity */ public function deleteEntity($entity) { parent::deleteEntity($entity); $objects = ['lead' => 'leads', 'company' => 'companies']; $object = $objects[$entity->getObject()]; //remove the column from the leads table $leadsSchema = $this->schemaHelperFactory->getSchemaHelper('column', $object); $leadsSchema->dropColumn($entity->getAlias()); $leadsSchema->executeChanges(); }
/** * @param object $entity */ public function deleteEntity($entity) { // Delete custom avatar if one exists $imageDir = $this->factory->getSystemPath('images', true); $avatar = $imageDir . '/lead_avatars/avatar' . $entity->getId(); if (file_exists($avatar)) { unlink($avatar); } parent::deleteEntity($entity); }
/** * {@inheritdoc} * * @throws PreconditionRequiredHttpException */ public function deleteEntity($entity) { if (!$entity instanceof Role) { throw new MethodNotAllowedHttpException(['Role'], 'Entity must be of class Role()'); } $users = $this->em->getRepository('MauticUserBundle:User')->findByRole($entity); if (count($users)) { throw new PreconditionRequiredHttpException($this->translator->trans('mautic.user.role.error.deletenotallowed', ['%name%' => $entity->getName()], 'flashes')); } parent::deleteEntity($entity); }
/** * Delete an entity * * @param $entity * @return null|object */ public function deleteEntity($entity) { $bundle = $entity->getBundle(); //if it doesn't have a dot, then assume the model will be $bundle.$bundle $modelName = strpos($bundle, '.') === false ? $bundle . '.' . $bundle : $bundle; $model = $this->factory->getModel($modelName); $repo = $model->getRepository(); $tableAlias = $repo->getTableAlias(); $entities = $model->getEntities(array('filter' => array('force' => array(array('column' => $tableAlias . '.category', 'expr' => 'eq', 'value' => $entity->getId()))))); if (!empty($entities)) { foreach ($entities as $e) { $e->setCategory(null); } $model->saveEntities($entities, false); } parent::deleteEntity($entity); }
/** * @param object $entity */ public function deleteEntity($entity) { // Null all the event parents for this campaign to avoid database constraints $this->getEventRepository()->nullEventParents($entity->getId()); parent::deleteEntity($entity); }