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


PHP ObjectManager::remove方法代码示例

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


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

示例1: deleteSubscriptions

 /**
  * Delete all Subscriptions of an Exercise.
  *
  * @param Exercise $exercise
  * @param bool     $flush
  *
  * @return SubscriptionManager
  */
 public function deleteSubscriptions(Exercise $exercise, $flush = false)
 {
     $subscriptions = $this->om->getRepository('UJMExoBundle:Subscription')->findByExercise($exercise);
     foreach ($subscriptions as $subscription) {
         $this->om->remove($subscription);
     }
     if ($flush) {
         $this->om->flush();
     }
     return $this;
 }
开发者ID:claroline,项目名称:distribution,代码行数:19,代码来源:SubscriptionManager.php

示例2: updateDefaultPerms

 public function updateDefaultPerms()
 {
     $tools = array(array('home', false, true), array('parameters', true, true), array('resource_manager', false, true), array('agenda', false, true), array('logs', false, true), array('analytics', false, true), array('users', false, true), array('badges', false, true));
     $this->log('updating tools...');
     foreach ($tools as $tool) {
         $entity = $this->om->getRepository('ClarolineCoreBundle:Tool\\Tool')->findOneByName($tool[0]);
         if ($entity) {
             $entity->setIsLockedForAdmin($tool[1]);
             $entity->setIsAnonymousExcluded($tool[2]);
             $this->om->persist($entity);
         }
     }
     $this->log('updating resource types...');
     $resourceTypes = $this->om->getRepository('ClarolineCoreBundle:Resource\\ResourceType')->findAll();
     foreach ($resourceTypes as $resourceType) {
         $resourceType->setDefaultMask(1);
         $this->om->persist($resourceType);
     }
     $this->om->flush();
     $this->log('updating manager roles...');
     $this->log('this may take a while...');
     $managerRoles = $this->om->getRepository('ClarolineCoreBundle:Role')->searchByName('ROLE_WS_MANAGER');
     foreach ($managerRoles as $role) {
         $this->conn->query("DELETE FROM claro_ordered_tool_role\n                WHERE role_id = {$role->getId()}");
     }
     $this->log('updating resource rights...');
     $this->log('removing administrator rights...');
     $roleAdmin = $this->om->getRepository('ClarolineCoreBundle:Role')->findOneByName('ROLE_ADMIN');
     $adminRights = $this->om->getRepository('ClarolineCoreBundle:Resource\\ResourceRights')->findBy(array('role' => $roleAdmin));
     foreach ($adminRights as $adminRight) {
         $this->om->remove($adminRight);
     }
     $this->om->flush();
     $this->log('adding user rights... ');
     $this->log('it may take a while...');
     $resourceNodes = $this->om->getRepository('ClarolineCoreBundle:Resource\\ResourceNode')->findAll();
     $roleUser = $this->om->getRepository('ClarolineCoreBundle:Role')->findOneByName('ROLE_USER');
     $this->om->startFlushSuite();
     $i = 0;
     foreach ($resourceNodes as $resourceNode) {
         $rightsManager = $this->container->get('claroline.manager.rights_manager');
         $rightsManager->create(0, $roleUser, $resourceNode, false);
         $i++;
         if ($i % 200 === 0) {
             $this->om->endFlushSuite();
             $this->om->startFlushSuite();
         }
     }
     $this->om->endFlushSuite();
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:50,代码来源:Updater021000.php

示例3: deleteAssociatedShortcuts

 private function deleteAssociatedShortcuts(ResourceNode $resourceNode)
 {
     $this->om->startFlushSuite();
     $shortcuts = $this->shortcutRepo->findByTarget($resourceNode);
     foreach ($shortcuts as $shortcut) {
         $this->om->remove($shortcut->getResourceNode());
     }
     $this->om->endFlushSuite();
 }
开发者ID:ChMat,项目名称:CoreBundle,代码行数:9,代码来源:ResourceManager.php

示例4: deleteTranslation

 /**
  * Delete a translation of content.
  *
  * @param string $locale
  * @param $id
  */
 public function deleteTranslation($locale, $id)
 {
     if ($locale === 'en') {
         $content = $this->content->findOneBy(array('id' => $id));
     } else {
         $content = $this->translations->findOneBy(array('foreignKey' => $id, 'locale' => $locale));
     }
     if ($content instanceof ContentTranslation || $content instanceof Content) {
         $this->manager->remove($content);
         $this->manager->flush();
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:18,代码来源:ContentManager.php

示例5: delete

 /**
  * @param \Claroline\CoreBundle\Entity\Resource\ResourceIcon $icon
  */
 public function delete(ResourceIcon $icon, Workspace $workspace = null)
 {
     if ($icon->getMimeType() === 'custom') {
         //search if this icon is used elsewhere (ie copy)
         $res = $this->om->getRepository('ClarolineCoreBundle:Resource\\ResourceNode')->findBy(array('icon' => $icon));
         if (count($res) <= 1 && $icon->isShortcut() === false) {
             $shortcut = $icon->getShortcutIcon();
             $this->om->remove($shortcut);
             $this->om->remove($icon);
             $this->om->flush();
             $this->removeImageFromThumbDir($icon, $workspace);
             $this->removeImageFromThumbDir($icon->getShortcutIcon(), $workspace);
         }
     }
 }
开发者ID:ChMat,项目名称:CoreBundle,代码行数:18,代码来源:IconManager.php

示例6: deletePapers

 /**
  * Deletes all the papers associated with an exercise.
  *
  * @todo optimize request number using repository method(s)
  *
  * @param Exercise $exercise
  *
  * @throws \Exception if the exercise has been published at least once
  */
 public function deletePapers(Exercise $exercise)
 {
     if ($exercise->wasPublishedOnce()) {
         throw new \Exception("Cannot delete exercise {$exercise->getId()} papers as it has been published at least once");
     }
     $paperRepo = $this->om->getRepository('UJMExoBundle:Paper');
     $linkHintPaperRepo = $this->om->getRepository('UJMExoBundle:LinkHintPaper');
     $responseRepo = $this->om->getRepository('UJMExoBundle:Response');
     $papers = $paperRepo->findByExercise($exercise);
     foreach ($papers as $paper) {
         $links = $linkHintPaperRepo->findByPaper($paper);
         foreach ($links as $link) {
             $this->om->remove($link);
         }
         $responses = $responseRepo->findByPaper($paper);
         foreach ($responses as $response) {
             $this->om->remove($response);
         }
         $this->om->remove($paper);
     }
     $this->om->flush();
 }
开发者ID:claroline,项目名称:distribution,代码行数:31,代码来源:ExerciseManager.php

示例7: deleteDuplicatedOldOrderedTools

 public function deleteDuplicatedOldOrderedTools()
 {
     $usersOts = $this->orderedToolRepo->findDuplicatedOldOrderedToolsByUsers();
     $wsOts = $this->orderedToolRepo->findDuplicatedOldOrderedToolsByWorkspaces();
     $exitingUsers = array();
     foreach ($usersOts as $ot) {
         $toolId = $ot->getTool()->getId();
         $userId = $ot->getUser()->getId();
         if (isset($exitingUsers[$toolId])) {
             if (isset($exitingUsers[$toolId][$userId])) {
                 $this->om->remove($ot);
             } else {
                 $exitingUsers[$toolId][$userId] = true;
             }
         } else {
             $exitingUsers[$toolId] = array();
             $exitingUsers[$toolId][$userId] = true;
         }
     }
     $this->om->flush();
     $exitingWorkspaces = array();
     foreach ($wsOts as $ot) {
         $toolId = $ot->getTool()->getId();
         $workspaceId = $ot->getWorkspace()->getId();
         if (isset($exitingWorkspaces[$toolId])) {
             if (isset($exitingWorkspaces[$toolId][$workspaceId])) {
                 $this->om->remove($ot);
             } else {
                 $exitingWorkspaces[$toolId][$workspaceId] = true;
             }
         } else {
             $exitingWorkspaces[$toolId] = array();
             $exitingWorkspaces[$toolId][$workspaceId] = true;
         }
     }
     $this->om->flush();
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:37,代码来源:ToolManager.php

示例8: removeFavourite

 /**
  * Removes a favourite workspace.
  *
  * @param \Claroline\CoreBundle\Entity\Workspace\WorkspaceFavourite $favourite
  */
 public function removeFavourite(WorkspaceFavourite $favourite)
 {
     $this->om->remove($favourite);
     $this->om->flush();
 }
开发者ID:ChMat,项目名称:CoreBundle,代码行数:10,代码来源:WorkspaceManager.php

示例9: deletePage

 public function deletePage(WebsitePage $page)
 {
     $this->objectManager->remove($page);
     $this->objectManager->flush();
 }
开发者ID:claroline,项目名称:distribution,代码行数:5,代码来源:WebsitePageManager.php


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