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


PHP Registry::getEntityManager方法代码示例

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


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

示例1: getAllByWebsiteId

 /**
  * @param  string $websiteId
  * @return array[] \Orm\Entity\Group
  */
 public function getAllByWebsiteId($websiteId)
 {
     // Website vorhanden?
     $website = $this->getService('Website')->getById($websiteId);
     $groups = $this->getService()->getAllByWebsiteId($website->getId());
     if (is_array($groups) && count($groups) > 0) {
         $entityManager = \Seitenbau\Registry::getEntityManager();
         foreach ($groups as $group) {
             if (is_array($group->getUsers())) {
                 $usersOfGroup = $group->getUsers();
             } else {
                 $usersOfGroup = json_decode($group->getUsers());
             }
             if (is_array($usersOfGroup) && count($usersOfGroup) > 0) {
                 $userService = $this->getService('User');
                 $userOrms = array();
                 foreach ($usersOfGroup as $userId) {
                     if ($userId instanceof \Orm\Entity\User) {
                         $userId = $userId->getId();
                     }
                     $user = $userService->getById($userId);
                     $groupsOfUser = $this->getService()->getAllByUserId($user->getId());
                     $user->setGroups($groupsOfUser);
                     $userOrms[] = $user;
                     $entityManager->detach($user);
                 }
                 $group->setUsers($userOrms);
             } else {
                 $group->setUsers(array());
             }
             $entityManager->detach($group);
         }
     }
     return $groups;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:39,代码来源:Group.php

示例2: setEntityManagerShouldSetEntityManager

 /**
  * @test
  * @group library
  */
 public function setEntityManagerShouldSetEntityManager()
 {
     $this->assertInstanceOf('Doctrine\\ORM\\EntityManager', Registry::getEntityManager());
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:8,代码来源:RegistryTest.php

示例3: getDoctrineMigrationConfig

 protected function getDoctrineMigrationConfig()
 {
     $config = Registry::getConfig();
     // Doctrine Migration
     $entityManager = Registry::getEntityManager();
     $configuration = new \Doctrine\DBAL\Migrations\Configuration\Configuration($entityManager->getConnection());
     $configuration->setName($config->migration->doctrine->name);
     $configuration->setMigrationsNamespace($config->migration->doctrine->migrations_namespace);
     $configuration->setMigrationsTableName($config->migration->doctrine->table_name);
     $configuration->setMigrationsDirectory($config->migration->doctrine->migrations_directory);
     $configuration->registerMigrationsFromDirectory($configuration->getMigrationsDirectory());
     return $configuration;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:13,代码来源:Cli.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$entityManager = Registry::getEntityManager();
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:4,代码来源:TransactionTestCase.php

示例5: initEntityManager

 /**
  * init the doctrine entity manager form registry
  */
 protected function initEntityManager()
 {
     $this->setEntityManager(Registry::getEntityManager());
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:Doctrine.php

示例6: getEntityManager

 /**
  * @return \Doctrine\ORM\EntityManager
  */
 protected function getEntityManager()
 {
     return Registry::getEntityManager();
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:DBHelper.php


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