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


PHP EntityManager::getRepository方法代码示例

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


在下文中一共展示了EntityManager::getRepository方法的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: 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

示例3: transfuse

 public function transfuse(SearchMetadata $searchMeta)
 {
     $class = $this->entityManager->getClassMetadata($searchMeta->getName());
     $repository = $this->entityManager->getRepository($searchMeta->getName());
     $this->createAndUpdate($class, $repository);
     $this->dropOld($class, $repository);
 }
开发者ID:rohlikcz,项目名称:DoctrineSearch,代码行数:7,代码来源:DefaultEntityRiver.php

示例4: __construct

 public function __construct(EntityManager $entityManager, CommentRemover $commentRemover, CommentPersister $commentPersister)
 {
     $this->em = $entityManager;
     $this->commentRemover = $commentRemover;
     $this->commentPersister = $commentPersister;
     $this->commentsRepository = $this->em->getRepository(Comment::class);
 }
开发者ID:blitzik,项目名称:CMS,代码行数:7,代码来源:CommentFacade.php

示例5: __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

示例6: __construct

 public function __construct(EntityManager $entityManager, UrlPersister $urlPersister, UrlLinker $urlLinker, Logger $logger)
 {
     $this->em = $entityManager;
     $this->urlPersister = $urlPersister;
     $this->logger = $logger->channel('urlsEntities');
     $this->urlLinker = $urlLinker;
     $this->urlRepository = $this->em->getRepository(Url::class);
 }
开发者ID:blitzik,项目名称:CMS,代码行数:8,代码来源:UrlFacade.php

示例7: __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

示例8: __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

示例9: __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

示例10: __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

示例11: __construct

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

示例12: __construct

 public function __construct(EntityManager $entityManager, PagePersister $pagePersister, PageRemover $pageRemover, IStorage $storage, Logger $logger)
 {
     $this->em = $entityManager;
     $this->pagePersister = $pagePersister;
     $this->pageRemover = $pageRemover;
     $this->logger = $logger->channel('pages');
     $this->cache = new Cache($storage, 'pages');
     $this->pageRepository = $this->em->getRepository(Page::class);
 }
开发者ID:blitzik,项目名称:CMS,代码行数:9,代码来源:PageFacade.php

示例13: emailFormSucceeded

 public function emailFormSucceeded(Form $form, $values)
 {
     $settings = $this->EntityManager->getRepository(Settings::getClassName());
     $setting = $settings->find(1);
     $mail = new Message();
     $mail->setFrom($values['email'])->addTo($setting->admin_email)->setSubject('Zpráva z webu PeTr - ' . $values['subject'])->setBody('Zpráva od ' . $values['name'] . '<br /><br />' . $values['message']);
     $mailer = new SendmailMailer();
     //$mailer->send($mail);
     $this->redirect('Contact:sent');
 }
开发者ID:B4rtosek,项目名称:sislak,代码行数:10,代码来源:ContactPresenter.php

示例14: __construct

 /**
  * @param Container $container
  * @param EntityManager $entityManager
  */
 public function __construct(Container $container, EntityManager $entityManager)
 {
     parent::__construct('dwarfSearch:import');
     $this->entityManager = $entityManager;
     $this->seasonsRepository = $entityManager->getRepository(Season::class);
     $this->episodesRepository = $entityManager->getRepository(Episode::class);
     $this->languagesRepository = $entityManager->getRepository(Language::class);
     $this->charactersRepository = $entityManager->getRepository(Character::class);
     $this->scenariosDir = $container->expand('%appDir%/../scenarios');
 }
开发者ID:stekycz,项目名称:dwarf-search,代码行数:14,代码来源:ScreenplayImportCommand.php

示例15: __construct

 public function __construct(EntityManager $entityManager, AlbumCoverProvider $albumCoverProvider, string $songsDirectory)
 {
     $this->entityManager = $entityManager;
     $this->songsDirectory = $songsDirectory;
     $this->albumCoverProvider = $albumCoverProvider;
     $this->songRepository = $entityManager->getRepository(Song::getClassName());
     $this->genresRepository = $entityManager->getRepository(Genre::getClassName());
     $this->addFunctions();
     $this->genreCache = [];
     $this->hashCache = [];
 }
开发者ID:ParalelniPolis,项目名称:bitcoinJukebox,代码行数:11,代码来源:SongsManager.php


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