當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectManager::remove方法代碼示例

本文整理匯總了PHP中Doctrine\Common\Persistence\ObjectManager::remove方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::remove方法的具體用法?PHP ObjectManager::remove怎麽用?PHP ObjectManager::remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\Common\Persistence\ObjectManager的用法示例。


在下文中一共展示了ObjectManager::remove方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: remove

 public function remove(TestSuiteInterface $test_suite, $flush = true)
 {
     $this->object_manager->remove($test_suite);
     if ($flush) {
         $this->object_manager->flush();
     }
 }
開發者ID:naholyr,項目名稱:ABBundle,代碼行數:7,代碼來源:DoctrineManager.php

示例2: cleanDatabase

 protected function cleanDatabase()
 {
     foreach ($this->repository->findStatements(array()) as $statement) {
         $this->objectManager->remove($statement);
     }
     $this->objectManager->flush();
 }
開發者ID:php-xapi,項目名稱:repository-doctrine,代碼行數:7,代碼來源:StatementRepositoryTest.php

示例3: syncCronjobs

 public function syncCronjobs()
 {
     $dbCronjobs = $this->getDatabaseCronjobs();
     foreach ($this->configCronjobs as $jobId => $job) {
         if (!isset($dbCronjobs[$jobId])) {
             $cronjob = $this->createCronjob();
             $cronjob->setId($jobId);
             $this->om->persist($cronjob);
             $dbCronjobs[$jobId] = $cronjob;
         } else {
             $cronjob = $dbCronjobs[$jobId];
         }
         $cronjob->setCommand($job['command']);
         $cronjob->setArguments($job['arguments']);
         $cronjob->setCronExpression($job['expression']);
         $cronjob->setExecuteTimeout($job['execute_timeout']);
         $cronjob->setLogFile($job['log_file']);
     }
     $i = 0;
     foreach ($dbCronjobs as $job_id => $cronjob) {
         if (!isset($this->configCronjobs[$job_id])) {
             if (!$cronjob->isLocked()) {
                 $this->om->remove($cronjob);
                 unset($dbCronjobs[$job_id]);
             }
         } else {
             $cronjob->setPriority($i++);
         }
     }
     $this->om->flush();
 }
開發者ID:agentsib,項目名稱:crontab-bundle,代碼行數:31,代碼來源:AbstractCrontabManager.php

示例4: doDelete

 /**
  * {@inheritdoc}
  */
 protected function doDelete($object, $flush = true)
 {
     $this->manager->remove($object);
     if ($flush) {
         $this->flush($object);
     }
 }
開發者ID:php-lug,項目名稱:lug,代碼行數:10,代碼來源:DomainManager.php

示例5: delete

 /**
  * Delete resource
  * 
  * @param mixed $id Id
  * 
  * @return void
  */
 public function delete($id)
 {
     if ($object = $this->fetch($id)) {
         $this->objectManager->remove($object);
         $this->objectManager->flush();
     }
 }
開發者ID:nicovogelaar,項目名稱:crud-controller-module,代碼行數:14,代碼來源:CrudRepository.php

示例6: onSave

 /**
  * @param ResourceEvent $resourceEvent
  */
 public function onSave(ResourceEvent $resourceEvent)
 {
     //        var_dump($resourceEvent);
     //        $module = $resourceEvent->getContainer()->getModule();
     $entities = $this->moduleRepository->setClass(new ResourceRepository())->findByAllResources();
     $entitiesToRemove = $this->objectManager->getRepository("BigfishCoreBundle:CacheRouting")->findAll();
     $flush = false;
     foreach ($entitiesToRemove as $remove) {
         $this->objectManager->remove($remove);
         $flush = true;
     }
     if ($flush) {
         $this->objectManager->flush();
     }
     $flush = false;
     foreach ($entities as $entity) {
         if (isset($entity["resource_id"])) {
             //
             $resource = $this->objectManager->getRepository("BigfishCoreBundle:Resource")->find($entity["resource_id"]);
             if ($resource) {
                 $routeData = $this->getParentsEntities($entities, $entity["resource_id"]);
                 $route = new CacheRouting();
                 $route->setResource($resource);
                 $route->setLanguage($this->languageManager->getObject());
                 $path = $this->validateSlug($entity["routerPath"], $routeData);
                 $route->setPath($path);
                 $this->objectManager->persist($route);
                 $flush = true;
             }
         }
     }
     if ($flush) {
         $this->objectManager->flush();
     }
 }
開發者ID:bigfishcmf,項目名稱:bigfishcmf,代碼行數:38,代碼來源:ResourceListener.php

示例7: create

 /**
  * @param Attachment $attachment
  * @param array      $dimensionIds
  *
  * @return ImageInstance
  */
 public function create(Attachment $attachment, DimensionContainer $dimensionContainer)
 {
     $validate = $this->constraints->getConstraints($attachment, $dimensionContainer);
     if ($validate) {
         $fs = new Filesystem();
         $fs->remove(sprintf('%s/%s', $this->tempPath, $attachment->getFile()));
         $fs->remove(sprintf('%s/%s', $this->uploadPath, $attachment->getFile()));
         $this->objectManager->remove($attachment);
         $this->objectManager->flush();
         return $validate;
     }
     $instance = new ImageInstance();
     $instance->setName($attachment->getName());
     $this->objectManager->persist($instance);
     foreach ($dimensionContainer->getDimensions() as $dimension) {
         $cropping = new ImageCropping();
         $cropping->setAttachment($attachment);
         $cropping->setInstance($instance);
         $cropping->setDimension($dimension);
         $cropping->setName($attachment->getName());
         $this->objectManager->persist($cropping);
     }
     $this->objectManager->flush();
     return $instance;
 }
開發者ID:bigfishcmf,項目名稱:bigfishcmf,代碼行數:31,代碼來源:ImageManager.php

示例8: delete

 /**
  * @param LocationModel $location
  * @param bool          $withFlush
  */
 public function delete(LocationModel $location, $withFlush = true)
 {
     $this->objectManager->remove($location);
     if ($withFlush) {
         $this->objectManager->flush();
     }
 }
開發者ID:Appartin,項目名稱:CoreBundle,代碼行數:11,代碼來源:LocationManager.php

示例9: remove

 /**
  * {@inheritdoc}
  */
 public function remove($object, array $options = [])
 {
     if (!$object instanceof SequentialEdit) {
         throw new \InvalidArgumentException(sprintf('Expects a Pim\\Bundle\\EnrichBundle\\Entity\\SequentialEdit, "%s" provided', ClassUtils::getClass($object)));
     }
     $this->om->remove($object);
     $this->om->flush($object);
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:11,代碼來源:SequentialEditManager.php

示例10: remove

 /**
  * {@inheritdoc}
  */
 public function remove($object, array $options = [])
 {
     if (false === $object instanceof $this->removedClass) {
         throw new \InvalidArgumentException(sprintf('Expects a "%s", "%s" provided.', $this->removedClass, ClassUtils::getClass($object)));
     }
     $this->objectManager->remove($object);
     $this->objectManager->flush();
 }
開發者ID:akeneo,項目名稱:badger,代碼行數:11,代碼來源:BaseRemover.php

示例11: pruneOldMapping

 /**
  * Prune old instance of simple mapping for the given identifier.
  *
  * @param string $identifier
  */
 protected function pruneOldMapping($identifier)
 {
     $oldMappingItems = $this->getEntityRepository()->findBy(array('identifier' => $identifier));
     foreach ($oldMappingItems as $oldMappingItem) {
         $this->objectManager->remove($oldMappingItem);
     }
     $this->objectManager->flush();
 }
開發者ID:rskonieczka,項目名稱:MagentoConnectorBundle,代碼行數:13,代碼來源:SimpleMappingManager.php

示例12: delete

 /**
  * @param  Post $post
  * @throws UnauthorizedException
  */
 public function delete(Post $post)
 {
     if (!$this->authorizationService->isGranted(self::DELETE)) {
         throw new UnauthorizedException();
     }
     $this->objectManager->remove($post);
     $this->objectManager->flush();
 }
開發者ID:omusico,項目名稱:MostadBlogApplication,代碼行數:12,代碼來源:PostService.php

示例13: delete

 public function delete(Recipe $recipe)
 {
     if (false === $this->authorizationService->isGranted('recipe.manage', $recipe)) {
         throw new UnauthorizedException('Insufficient Permissions');
     }
     $this->objectManager->remove($recipe);
     $this->objectManager->flush();
 }
開發者ID:Indigo1337,項目名稱:c4d,代碼行數:8,代碼來源:WriteService.php

示例14: deleteThread

 /**
  * Create thread since intervention
  * @param InterventionEvent $event
  */
 public function deleteThread(InterventionEvent $event)
 {
     $entity = $event->getIntervention();
     $starter = $this->om->getRepository('JLMFollowBundle:StarterIntervention')->findOneBy(array('intervention' => $entity));
     $thread = $this->om->getRepository('JLMFollowBundle:Thread')->findOneBy(array('starter' => $starter));
     $this->om->remove($thread);
     $this->om->remove($starter);
     $this->om->flush();
 }
開發者ID:jlm-entreprise,項目名稱:follow-bundle,代碼行數:13,代碼來源:InterventionSubscriber.php

示例15: deleteWorkFromIntervention

 /**
  * Create work since intervention
  * @param InterventionEvent $event
  */
 public function deleteWorkFromIntervention(InterventionEvent $event)
 {
     $interv = $event->getIntervention();
     $work = $interv->getWork();
     $interv->setWork();
     $this->om->remove($work);
     $this->om->persist($interv);
     $this->om->flush();
 }
開發者ID:jlm-entreprise,項目名稱:daily-bundle,代碼行數:13,代碼來源:InterventionSubscriber.php


注:本文中的Doctrine\Common\Persistence\ObjectManager::remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。