当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManager::remove方法代码示例

本文整理汇总了PHP中EntityManager::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::remove方法的具体用法?PHP EntityManager::remove怎么用?PHP EntityManager::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityManager的用法示例。


在下文中一共展示了EntityManager::remove方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: remove

 /**
  * @param null $criteria
  * @return mixed
  */
 public function remove($criteria = null)
 {
     if (!isset($criteria)) {
         $criteria = array("id" => $this->getPrimaryKey());
     }
     return $this->entityManager->remove($this->tableName, $criteria);
 }
开发者ID:abelduarte,项目名称:PHP-EntityManager,代码行数:11,代码来源:Entity.class.php

示例2: testHelperReset

 /**
  * Test helper to reset testing data
  *
  * @return void
  */
 public function testHelperReset()
 {
     $test_transaction = $this->testHelperGet();
     if (!is_null($test_transaction)) {
         $this->em->remove($test_transaction);
         $this->em->flush();
     }
 }
开发者ID:jardarn,项目名称:UKMokonomi,代码行数:13,代码来源:TransactionService.php

示例3: clearWebcode

 /**
  * Clears old webcode
  *
  * @param EntityManager $em            Entity Manager
  * @param string        $articleNumber Article
  *
  * @return void
  */
 private function clearWebcode($em, $articleNumber, $articleLanguage)
 {
     $webcode = $em->getRepository('Newscoop\\Entity\\Webcode')->createQueryBuilder('w')->leftJoin('w.article', 'a')->where('a.number = :number')->andWhere('a.language = :language')->setParameter('number', $articleNumber)->setParameter('language', $articleLanguage)->getQuery()->getOneOrNullResult();
     if ($webcode) {
         $em->remove($webcode);
         $em->flush();
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:16,代码来源:GenerateWebcodeCommand.php

示例4: delete

 /**
  * Delete controller
  *
  * @param Request  $request
  * @param Response $response
  * @param array    $args
  *
  * @return Response
  */
 public function delete(Request $request, Response $response, array $args)
 {
     $entity = $this->em->getRepository($this->entityClass)->find($args['id']);
     if ($entity) {
         $this->em->remove($entity);
         $this->em->flush();
     }
     return new RedirectResponse($this->route);
 }
开发者ID:indigophp,项目名称:proton-crud,代码行数:18,代码来源:Controller.php

示例5: remove

 /**
  * {@inheritDoc}
  */
 public function remove($content)
 {
     if (!is_array($content)) {
         $content = [$content];
     }
     $content = $this->getRepository()->findByIds($content);
     foreach ($content as $item) {
         $this->em->remove($item);
     }
     $this->em->flush();
 }
开发者ID:NickyBeunder,项目名称:ContentBundle,代码行数:14,代码来源:ContentManager.php

示例6: testAuditable

 public function testAuditable()
 {
     $user = new UserAudit("beberlei");
     $article = new ArticleAudit("test", "yadda!", $user, 'text');
     $this->em->persist($user);
     $this->em->persist($article);
     $this->em->flush();
     $this->assertEquals(1, count($this->em->getConnection()->fetchAll('SELECT id FROM revisions')));
     $this->assertEquals(1, count($this->em->getConnection()->fetchAll('SELECT * FROM UserAudit_audit')));
     $this->assertEquals(1, count($this->em->getConnection()->fetchAll('SELECT * FROM ArticleAudit_audit')));
     $article->setText("oeruoa");
     $this->em->flush();
     $this->assertEquals(2, count($this->em->getConnection()->fetchAll('SELECT id FROM revisions')));
     $this->assertEquals(2, count($this->em->getConnection()->fetchAll('SELECT * FROM ArticleAudit_audit')));
     $this->em->remove($user);
     $this->em->remove($article);
     $this->em->flush();
     $this->assertEquals(3, count($this->em->getConnection()->fetchAll('SELECT id FROM revisions')));
     $this->assertEquals(2, count($this->em->getConnection()->fetchAll('SELECT * FROM UserAudit_audit')));
     $this->assertEquals(3, count($this->em->getConnection()->fetchAll('SELECT * FROM ArticleAudit_audit')));
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:21,代码来源:FunctionalTest.php

示例7: testHelperReset

 /**
  * Test helper to reset testing data
  *
  * @return void
  */
 public function testHelperReset()
 {
     $test_SubProject = $this->testHelperGet();
     if (!is_null($test_SubProject)) {
         $this->em->remove($test_SubProject);
         $this->em->flush();
     }
     $test_SubProject_2 = $this->repo->findOneByName('TestDelprosjekt2');
     if (!is_null($test_SubProject_2)) {
         $this->em->remove($test_SubProject_2);
         $this->em->flush();
     }
 }
开发者ID:jardarn,项目名称:UKMokonomi,代码行数:18,代码来源:SubProjectService.php

示例8: testHelperReset

 /**
  * Test helper to reset testing data
  *
  * @return void
  */
 public function testHelperReset()
 {
     $test_budget = $this->testHelperGet();
     if (!is_null($test_budget)) {
         $this->em->remove($test_budget);
         $this->em->flush();
     }
     $test_budget_2 = $this->repo->findOneByName('TestBudsjett2');
     if (!is_null($test_budget_2)) {
         $this->em->remove($test_budget_2);
         $this->em->flush();
     }
 }
开发者ID:jardarn,项目名称:UKMokonomi,代码行数:18,代码来源:BudgetService.php

示例9: discardAll

 /**
  * @param integer $ownerId
  * @param integer $rootVersion
  */
 public function discardAll($ownerId)
 {
     $owner = $this->find($ownerId);
     if (!$owner instanceof BlockOwnerInterface) {
         throw new \Exception('Discard all changes is only possible on Block owners');
     }
     $this->killLoggableListener();
     $this->killSoftDeletableListener();
     $this->em->getRepository('OpiferContentBundle:BlockLogEntry')->discardAll($ownerId);
     if ($this->em->getFilters()->isEnabled('softdeleteable')) {
         $this->em->getFilters()->disable('softdeleteable');
     }
     $stubs = $this->getRepository()->findBy(['owner' => $owner, 'version' => 0]);
     foreach ($stubs as $stub) {
         $this->em->remove($stub);
     }
     $this->em->flush();
 }
开发者ID:RobertjanSchipper,项目名称:Cms,代码行数:22,代码来源:BlockManager.php

示例10: deleteThread

 /**
  * Deletes a thread
  *
  * @param ThreadInterface $thread the thread to delete
  */
 public function deleteThread(ThreadInterface $thread)
 {
     $this->em->remove($thread);
     $this->em->flush();
 }
开发者ID:sketchmedia,项目名称:FOSMessageBundle,代码行数:10,代码来源:ThreadManager.php

示例11: remove

 /**
  * Remove a directory
  *
  * @param  DirectoryInterface $directory
  */
 public function remove(DirectoryInterface $directory)
 {
     $this->em->remove($directory);
     $this->em->flush();
 }
开发者ID:leonverschuren,项目名称:Cms,代码行数:10,代码来源:DirectoryManager.php

示例12: delete

 /**
  * Delete a project
  *
  * @param Project $project
  */
 public function delete(Project $project)
 {
     $this->objectManager->remove($project);
     $this->objectManager->flush();
 }
开发者ID:NaszvadiG,项目名称:Jumph,代码行数:10,代码来源:ProjectManager.php


注:本文中的EntityManager::remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。