本文整理汇总了PHP中Doctrine\ORM\EntityManager::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::remove方法的具体用法?PHP EntityManager::remove怎么用?PHP EntityManager::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\EntityManager
的用法示例。
在下文中一共展示了EntityManager::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeEntity
/**
* @param $entity
*/
public function removeEntity($entity)
{
$this->em->remove($entity);
$this->em->flush();
$isFound = $this->em->getRepository(get_class($entity))->findOneBy(['id' => $entity->getId()]);
$this->assertNull($isFound);
}
示例2: delete
/**
* Delete a given article
* @param Article $article
*/
public function delete(Article $article, BusinessEntityPage $bep)
{
$this->entityManager->remove($bep);
$this->entityManager->remove($article);
//flush the modifications
$this->entityManager->flush();
}
示例3: remove
/**
* @param $object
* @param bool $isFlush
*/
protected function remove($object, $isFlush = false)
{
$this->em->remove($object);
if ($isFlush) {
$this->em->flush($object);
}
}
示例4: delete
/**
* @param object $object
* @param string $flush
*/
public function delete($object, $flush = true)
{
$this->entityManager->remove($object);
if ($flush) {
$this->entityManager->flush();
}
}
示例5: remove
/**
* @param Object $object
* @param boolean $flush
*/
public function remove($object, $flush = true)
{
$this->em->remove($object);
if ($flush) {
$this->em->flush();
}
}
示例6: delete
public function delete($invitation, $withFlush = false)
{
$this->entityManager->remove($invitation);
if ($withFlush) {
$this->entityManager->flush();
}
}
示例7: saveObjects
protected function saveObjects()
{
// Product information korábbi elemeinek törlése
$oldItems = $this->object->getInformation()->toArray();
if ($oldItems) {
foreach ($oldItems as $item) {
$this->entityManager->remove($item);
$this->object->removeInformation($item);
}
}
// Product information-be új elemek hozzá adása
if ($this->informationObjects) {
foreach ($this->informationObjects as $item) {
$this->object->addInformation($item);
}
}
// Product persist
$this->entityManager->persist($this->object);
// Product information persistek
if ($this->informationObjects) {
foreach ($this->informationObjects as $object) {
$this->entityManager->persist($object);
}
}
//Flush
$this->entityManager->flush();
}
示例8: remove
/**
* {@inheritdoc}
*/
public function remove(BannerInterface $banner, $save = false)
{
$this->em->remove($banner);
if (true === $save) {
$this->save();
}
}
示例9: excluir
/**
* @param $id
* @return integer
*/
public function excluir($id)
{
$entity = $this->em->getReference('Admin\\Domain\\Entity\\OtherEntity', (int) $id);
$this->em->remove($entity);
$this->em->flush();
return (int) $id;
}
示例10: remove
/**
* {@inheritdoc}
*/
public function remove(SeoMetadataInterface $seoMetadata, $save = false)
{
$this->em->remove($seoMetadata);
if (true === $save) {
$this->save();
}
}
示例11: remove
/**
* {@inheritdoc}
*/
public function remove(TreeInterface $tree, $save = false)
{
$this->em->remove($tree);
if (true === $save) {
$this->save();
}
}
示例12: remove
/**
* {@inheritdoc}
*/
public function remove(TextNodeInterface $textNode, $save = false)
{
$this->em->remove($textNode);
if (true === $save) {
$this->save();
}
}
示例13: remove
/**
* {@inheritdoc}
*/
public function remove(SiteInterface $site, $save = false)
{
$this->em->remove($site);
if (true === $save) {
$this->save();
}
}
示例14: saveReminders
/**
* Save reminders
*
* @param RemindableInterface $entity
*/
public function saveReminders(RemindableInterface $entity)
{
// Persist and flush new entity to get id
if (!($entityId = $this->getEntityIdentifier($entity))) {
$this->entityManager->persist($entity);
$this->entityManager->flush($entity);
$entityId = $this->getEntityIdentifier($entity);
}
$reminders = $entity->getReminders();
$reminderData = $entity->getReminderData();
$entityClass = $this->getEntityClassName($entity);
if (!$reminders instanceof RemindersPersistentCollection) {
foreach ($reminders as $reminder) {
$this->syncEntityReminder($reminder, $reminderData, $entityClass, $entityId);
$this->entityManager->persist($reminder);
}
} else {
if ($reminders->isDirty()) {
foreach ($reminders->getInsertDiff() as $reminder) {
$this->entityManager->persist($reminder);
}
foreach ($reminders->getDeleteDiff() as $reminder) {
$this->entityManager->remove($reminder);
}
}
foreach ($reminders as $reminder) {
$this->syncEntityReminder($reminder, $reminderData, $entityClass, $entityId);
}
}
}
示例15: updateInstitutionMedicalCenterListing
/**
* @param InstitutionMedicalCenter $center
*/
function updateInstitutionMedicalCenterListing(InstitutionMedicalCenter $center)
{
$institution = $center->getInstitution();
$criteria = array('institution' => $institution->getId(), 'institutionMedicalCenter' => $center->getId());
$recentlyApprovedListing = $this->em->getRepository('AdminBundle:RecentlyApprovedListing')->findOneBy($criteria);
if ($recentlyApprovedListing) {
if ($center->getStatus() == InstitutionMedicalCenterStatus::APPROVED) {
$recentlyApprovedListing->setDateUpdated(new \DateTime());
$this->em->persist($recentlyApprovedListing);
} else {
$this->em->remove($recentlyApprovedListing);
}
$this->em->flush();
} else {
if ($center->getStatus() == InstitutionMedicalCenterStatus::APPROVED) {
$recentlyApprovedListingService = new RecentlyApprovedListingService();
$recentlyApprovedListingService->setEntityManager($this->em);
$recentlyApprovedListing = new RecentlyApprovedListing();
$recentlyApprovedListing->setInstitution($institution);
$recentlyApprovedListing->setInstitutionMedicalCenter($center);
$recentlyApprovedListing->setDateUpdated(new \DateTime());
$recentlyApprovedListing->setStatus(1);
$this->em->persist($recentlyApprovedListing);
$this->em->flush($recentlyApprovedListing);
}
}
}