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


PHP Doctrine\EntityManager类代码示例

本文整理汇总了PHP中Kdyby\Doctrine\EntityManager的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager类的具体用法?PHP EntityManager怎么用?PHP EntityManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: renderDefault

 public function renderDefault()
 {
     $this->template->anyVariable = 'any value';
     //		$dao = $this->articles;
     $this->template->articles = $this->articles->getArticles()->findAll();
     $posts = $this->EntityManager->getRepository(Posts::getClassName());
     $this->template->posts = $posts->findAll();
     $this->template->myparametr = $this->context->parameters['first_parametr'];
     //		$this->template->test = $this->doSomeRefactoring('Hello world from blog');
     //		$post = new Posts();
     //		$post->title = 'New title';
     //		$post->text = 'New text New textNew text';
     //		$post->created_at = new \Nette\Utils\DateTime;
     //
     //
     //		$this->EntityManager->persist($post);
     //		$this->EntityManager->flush();
     //		$dao = $this->EntityManager->getRepository(Posts::getClassName());
     //		$dao->setTitle('test');
     //		$dao->__call('set', ['title' => 'my title']);
     //		dump($dao->__isset('title'));
     //		$dao->__set('title', 'test');
     try {
         $this->checkNum(2);
         \Tracy\Debugger::barDump('If you see this, the number is 1 or below');
     } catch (Nette\Application\BadRequestException $e) {
         Debugger::log('Message: ' . $e->getMessage());
         var_dump($e->getMessage());
     }
     //		finally {
     //			\Tracy\Debugger::barDump('Got here Finally');
     //		}
 }
开发者ID:regiss,项目名称:doctrine-sand,代码行数:33,代码来源:Blog.php

示例2: __construct

 public function __construct(EntityManager $em)
 {
     $this->em = $em;
     $this->streetRepository = $em->getRepository(Street::class);
     $this->partCityRepository = $em->getRepository(PartCity::class);
     $this->cityRepository = $em->getRepository(City::class);
 }
开发者ID:neogenia,项目名称:mvcr-street-api,代码行数:7,代码来源:ApiStreetsService.php

示例3: __construct

 public function __construct(EntityManager $entityManager, IAdminGridFactory $adminGridFactory, ITranslator $translator, RegistrationFormService $registrationFormService)
 {
     $this->registrationRepository = $entityManager->getRepository(Registration::class);
     $this->adminGridFactory = $adminGridFactory;
     $this->translator = $translator;
     $this->registrationFormService = $registrationFormService;
 }
开发者ID:venne,项目名称:venne,代码行数:7,代码来源:RegistrationTableFactory.php

示例4: __construct

 /**
  * @param EntityManager $entityManager
  * @param Client $elastic
  */
 public function __construct(EntityManager $entityManager, Client $elastic)
 {
     parent::__construct();
     $this->entityManager = $entityManager;
     $this->elastic = $elastic;
     $this->seasonsRepository = $entityManager->getRepository(Season::class);
     $this->languagesRepository = $entityManager->getRepository(Language::class);
 }
开发者ID:stekycz,项目名称:dwarf-search,代码行数:12,代码来源:ScreenplayExportCommand.php

示例5: __construct

 public function __construct(EntityManager $entityManager, TagPersister $tagPersister, TagRemover $tagRemover, Logger $logger)
 {
     $this->em = $entityManager;
     $this->tagPersister = $tagPersister;
     $this->logger = $logger->channel('Tags');
     $this->tagRepository = $this->em->getRepository(Tag::class);
     $this->tagRemover = $tagRemover;
 }
开发者ID:blitzik,项目名称:CMS,代码行数:8,代码来源:TagFacade.php

示例6: getLastPosition

 private function getLastPosition(EntityManager $em)
 {
     $last = $em->getRepository(get_class($this))->findOneBy([], ["position" => "DESC"]);
     if ($last) {
         return $last->getPosition();
     }
     return 0;
 }
开发者ID:lexinek,项目名称:doctrine-behaviors,代码行数:8,代码来源:OrderableMethods.php

示例7: __construct

 public function __construct(ImagesUploader $imagesUploader, ImagesRemover $imagesRemover, EntityManager $entityManager, Logger $logger)
 {
     $this->imagesUploader = $imagesUploader;
     $this->imagesRemover = $imagesRemover;
     $this->em = $entityManager;
     $this->logger = $logger->channel('images');
     $this->imageRepository = $this->em->getRepository(Image::class);
 }
开发者ID:blitzik,项目名称:CMS,代码行数:8,代码来源:ImageFacade.php

示例8: createBasicQuery

 private function createBasicQuery(Kdyby\Doctrine\EntityManager $entityManager)
 {
     $qb = $entityManager->createQueryBuilder();
     $qb->from(Comment::class, 'c');
     foreach ($this->filter as $modifier) {
         $modifier($qb);
     }
     return $qb;
 }
开发者ID:blitzik,项目名称:CMS,代码行数:9,代码来源:CommentQuery.php

示例9: __construct

 public function __construct(\Kdyby\Doctrine\EntityManager $entityManager)
 {
     if (!$this->table_name) {
         throw new \Exception('Variable $db_nam must be filled!');
     }
     $this->em = $entityManager;
     $entits = new $this->table_name();
     $this->entit = $this->em->getRepository($entits);
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:9,代码来源:BaseModel.php

示例10: isEntity

 /**
  * Check object status is enity
  *
  * @param object|string $entity
  * @return bool
  */
 protected function isEntity($entity)
 {
     if (is_object($entity)) {
         $entity = ClassUtils::getClass($entity);
     }
     return !$this->entityManager->getMetadataFactory()->isTransient($entity);
 }
开发者ID:pecinaon,项目名称:doctrine-mapper,代码行数:13,代码来源:BaseMapper.php

示例11: findEventsByType

 public function findEventsByType($logTypeID)
 {
     return $this->cache->load('logEvents-' . $logTypeID, function (&$dependencies) use($logTypeID) {
         return array_column($this->em->createQuery('SELECT e.id, e.name FROM ' . EventLog::class . ' e INDEX BY e.id
              WHERE e.logType = :typeID')->setParameter('typeID', $logTypeID)->getArrayResult(), 'name', 'id');
     });
 }
开发者ID:blitzik,项目名称:CMS,代码行数:7,代码来源:LogFacade.php

示例12: assignAlbums

 /**
  * @param User $user
  * @param array $albums
  */
 public function assignAlbums(User $user, array $albums)
 {
     $user->albums->clear();
     $user->setAlbums($albums);
     $this->em->persist($user);
     $this->em->flush();
 }
开发者ID:peterkrejci,项目名称:music-collection,代码行数:11,代码来源:UserModel.php

示例13: initialize

 public function initialize(IIdentity $identity)
 {
     if ($identity instanceof EntityIdentity && !$identity->isLoaded()) {
         $identity->load($this->em->getDao($identity->getEntityClass()));
     }
     return $identity;
 }
开发者ID:librette,项目名称:security-extension,代码行数:7,代码来源:EntityIdentityInitializer.php

示例14: createComponentGrid

 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $repository = $this->database->getRepository('App\\Models\\Doctrine\\Entities\\User');
     $model = new \Grido\DataSources\Doctrine($repository->createQueryBuilder('a')->addSelect('c')->innerJoin('a.country', 'c'), array('country' => 'c.title'));
     // Map country column to the title of the Country entity
     $grid->model = $model;
     $grid->addColumnText('firstname', 'Firstname')->setFilterText()->setSuggestion();
     $grid->addColumnText('surname', 'Surname')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('gender', 'Gender')->setSortable()->cellPrototype->class[] = 'center';
     $grid->addColumnDate('birthday', 'Birthday', \Grido\Components\Columns\Date::FORMAT_TEXT)->setSortable()->setFilterDate()->setCondition($grid->birthdayFilterCondition);
     $grid->getColumn('birthday')->cellPrototype->class[] = 'center';
     $grid->addColumnText('country', 'Country')->setSortable()->setCustomRender(function ($item) {
         $baseUri = $this->getBaseUri();
         $img = Html::el('img')->src("{$baseUri}/img/flags/{$item->country_code}.gif");
         return "{$img} {$item->country}";
     })->setFilterText()->setSuggestion();
     $grid->addColumnText('card', 'Card')->setSortable()->setColumn('cctype')->setReplacement(array('MasterCard' => Html::el('b')->setText('MasterCard')))->cellPrototype->class[] = 'center';
     $grid->addColumnEmail('emailaddress', 'Email')->setSortable()->setFilterText();
     $grid->getColumn('emailaddress')->cellPrototype->class[] = 'center';
     $grid->addColumnText('centimeters', 'Height')->setSortable()->setFilterNumber();
     $grid->getColumn('centimeters')->cellPrototype->class[] = 'center';
     $grid->addFilterSelect('gender', 'Gender', array('' => '', 'female' => 'female', 'male' => 'male'));
     $grid->addFilterSelect('card', 'Card', array('' => '', 'MasterCard' => 'MasterCard', 'Visa' => 'Visa'))->setColumn('cctype');
     $grid->addFilterCheck('preferred', 'Only preferred girls :)')->setCondition(array(TRUE => array(array('gender', 'AND', 'centimeters'), array('= ?', '>= ?'), array('female', 170))));
     $grid->addActionHref('edit', 'Edit')->setIcon('pencil');
     $grid->addActionHref('delete', 'Delete')->setIcon('trash')->setConfirm(function ($item) {
         return "Are you sure you want to delete {$item->firstname} {$item->surname}?";
     });
     $operation = array('print' => 'Print', 'delete' => 'Delete');
     $grid->setOperation($operation, $this->handleOperations)->setConfirm('delete', 'Are you sure you want to delete %i items?');
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
 }
开发者ID:o5,项目名称:grido-examples,代码行数:34,代码来源:DoctrinePresenter.php

示例15: addDefinition

 /**
  * @param Privilege $privilege
  * @param Role $role
  * @return $this
  */
 public function addDefinition(Privilege $privilege, Role $role)
 {
     $accessDefinition = new AccessDefinition($this->resource, $privilege);
     $this->em->persist($accessDefinition);
     $permission = new Permission($role, $this->resource, $privilege);
     $this->em->persist($permission);
     return $this;
 }
开发者ID:blitzik,项目名称:CMS,代码行数:13,代码来源:AuthorizationRulesGenerator.php


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