/** * 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(); }
/** * @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); }
/** * @param $object * @param bool $isFlush */ protected function remove($object, $isFlush = false) { $this->em->remove($object); if ($isFlush) { $this->em->flush($object); } }
/** * @param object $object * @param string $flush */ public function delete($object, $flush = true) { $this->entityManager->remove($object); if ($flush) { $this->entityManager->flush(); } }
/** * @param Object $object * @param boolean $flush */ public function remove($object, $flush = true) { $this->em->remove($object); if ($flush) { $this->em->flush(); } }
public function delete($invitation, $withFlush = false) { $this->entityManager->remove($invitation); if ($withFlush) { $this->entityManager->flush(); } }
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(); }
/** * {@inheritdoc} */ public function remove(BannerInterface $banner, $save = false) { $this->em->remove($banner); if (true === $save) { $this->save(); } }
/** * @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; }
/** * {@inheritdoc} */ public function remove(SeoMetadataInterface $seoMetadata, $save = false) { $this->em->remove($seoMetadata); if (true === $save) { $this->save(); } }
/** * {@inheritdoc} */ public function remove(TreeInterface $tree, $save = false) { $this->em->remove($tree); if (true === $save) { $this->save(); } }
/** * {@inheritdoc} */ public function remove(TextNodeInterface $textNode, $save = false) { $this->em->remove($textNode); if (true === $save) { $this->save(); } }
/** * {@inheritdoc} */ public function remove(SiteInterface $site, $save = false) { $this->em->remove($site); if (true === $save) { $this->save(); } }
/** * 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); } } }
/** * @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); } } }
protected function doDeleteWithLock(AggregateRootInterface $aggregate) { $this->entityManager->remove($aggregate); if ($this->forceFlushOnSave) { $this->entityManager->flush(); } }
/** * @param $entity * @param bool $andFlush */ public function delete($entity, $andFlush = true) { $this->em->remove($entity); if ($andFlush) { $this->em->flush(); } }
/** * @param string $pageName * @param string $programId */ private function removeIfExists($pageName, $programId) { $page = $this->getPageEntity($pageName, $programId); if ($page) { $this->entityManager->remove($page); } }
/** * {@inheritdoc} */ public function remove(ImageInterface $image, $save = false) { $this->em->remove($image); if (true === $save) { $this->save(); } }
/** * @param Request $request * @return RedirectResponse * @throws \Doctrine\ORM\ORMException */ public function deleteAction(Request $request) { $invoiceId = $request->get('invoiceId'); $invoiceReference = $this->entityManager->getReference('Invoicity\\Business\\Entity\\Invoice', $invoiceId); $this->entityManager->remove($invoiceReference); $this->entityManager->flush(); return new RedirectResponse($this->router->generate('invoicity_invoice_index')); }
/** * {@inheritDoc} */ public function remove($id) { if (false == ($readModel = $this->find($id))) { return false; } $this->entityManager->remove($readModel); $this->entityManager->flush(); }
/** * Delete a given article. * * @param Article $article */ public function delete(Article $article, BusinessPage $bep) { $this->entityManager->remove($bep); $article->setVisibleOnFront(0); $article->setDeletedAt(new \DateTime()); //flush the modifications $this->entityManager->flush(); }
public function delete($repository, $id) { $deleteItem = $this->em->getRepository($repository)->find($id); $this->assertNotNull($deleteItem); $this->em->remove($deleteItem); $this->em->flush(); $this->assertNull($deleteItem->getId()); }
public function remove($deviceToken) { if (!is_object($deviceToken)) { $deviceToken = $this->repository->findOneBy(['deviceToken' => $deviceToken]); } $this->em->remove($deviceToken); $this->em->flush(); }
public function removeItem($itemId, User $user) { $wallItem = $this->wallItemRepository->findOneBy(array("id" => $itemId, "user" => $user)); if ($wallItem !== null) { $this->em->remove($wallItem); $this->em->flush(); } }
/** * {@inheritDoc} */ public function remove(EntityInterface $entity, $flush = true) { $this->entityManager->remove($entity); if ($flush === true) { $this->entityManager->flush(); } return true; }
public function removeTag(File $file, Tag $tag) { foreach ($file->getFileTags() as $tagRelation) { if ($tagRelation->getTag()->getId() == $tag->getId()) { $this->em->remove($tagRelation); } } }
public function removeById($id) { $session = $this->findById($id); if (!is_null($session)) { $this->em->remove($session); $this->em->flush(); } }
/** * @param JobCalendar $jobCalendar */ public function deleteJobCalendar(JobCalendar $jobCalendar) { $this->transformer->setMode(AbstractTransformer::MODE_FULL); $model = $this->transformer->entityToModel($jobCalendar); $this->manager->remove($jobCalendar); $this->manager->flush(); $this->dispatcher->dispatch(JobCalendarEvents::DELETED, new JobCalendarDeletedEvent($model)); }
/** * Invalidate token * * @param Newscoop\Entity\User $user * @param string $action * @return void */ public function invalidateTokens(User $user, $action = 'any') { $tokens = $this->em->getRepository('Newscoop\\Entity\\UserToken')->findBy(array('user' => $user->getId(), 'action' => $action)); foreach ($tokens as $token) { $this->em->remove($token); } $this->em->flush(); }