本文整理汇总了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);
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
示例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')));
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例10: deleteThread
/**
* Deletes a thread
*
* @param ThreadInterface $thread the thread to delete
*/
public function deleteThread(ThreadInterface $thread)
{
$this->em->remove($thread);
$this->em->flush();
}
示例11: remove
/**
* Remove a directory
*
* @param DirectoryInterface $directory
*/
public function remove(DirectoryInterface $directory)
{
$this->em->remove($directory);
$this->em->flush();
}
示例12: delete
/**
* Delete a project
*
* @param Project $project
*/
public function delete(Project $project)
{
$this->objectManager->remove($project);
$this->objectManager->flush();
}