本文整理匯總了PHP中Mautic\CoreBundle\Model\FormModel::deleteEntity方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormModel::deleteEntity方法的具體用法?PHP FormModel::deleteEntity怎麽用?PHP FormModel::deleteEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mautic\CoreBundle\Model\FormModel
的用法示例。
在下文中一共展示了FormModel::deleteEntity方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteEntity
/**
* Delete an entity
*
* @param object $entity
*
* @return void
*/
public function deleteEntity($entity)
{
$this->getRepository()->nullVariantParent($entity->getId());
return parent::deleteEntity($entity);
}
示例2: deleteEntity
/**
* {@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();
}
示例3: deleteEntity
/**
* @param Email $entity
*/
public function deleteEntity($entity)
{
if ($entity->isVariant() && $entity->getIsPublished()) {
$this->resetVariants($entity);
}
parent::deleteEntity($entity);
}
示例4: deleteEntity
/**
* {@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();
}
}
示例5: deleteEntity
/**
* {@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();
}
示例6: deleteEntity
/**
* @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);
}
示例7: deleteEntity
/**
* {@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);
}
示例8: deleteEntity
/**
* 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);
}
示例9: deleteEntity
/**
* @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);
}