当前位置: 首页>>代码示例>>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;未经允许,请勿转载。