本文整理汇总了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');
// }
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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');
}
示例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');
}
示例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 = [];
}