• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Doctrine\EntityManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


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


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


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


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


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


示例17: switchEntities

 /**
  * @param $entity1
  * @param $entity2
  */
 private function switchEntities($entity1, $entity2)
 {
     $x = $entity1->priority;
     $entity1->priority = $entity2->priority;
     $entity2->priority = $x;
     $this->entityManager->persist($entity1, $entity2);
     $this->entityManager->flush();
 }
开发者ID:Kotys,项目名称:eventor.io,代码行数:12,代码来源:Sorter.php


示例18: logDb

 private function logDb($message, $status = NULL, $consumerTitle = NULL)
 {
     $log = new RmqLogConsumer();
     $log->consumerTitle = $consumerTitle;
     $log->message = $message;
     $log->status = $status;
     $this->em->persist($log);
     $this->em->flush();
 }
开发者ID:miloshavlicek,项目名称:rabbit-mq-consumer,代码行数:9,代码来源:Log.php


示例19: isEntity

 /**
  * @param string
  * @return bool
  */
 private function isEntity($className)
 {
     try {
         $this->em->getClassMetadata($className);
         return TRUE;
     } catch (Doctrine\Common\Persistence\Mapping\MappingException $e) {
         return FALSE;
     }
 }
开发者ID:Olicek,项目名称:DoctrineMethodsHydrator,代码行数:13,代码来源:ParametersToEntitiesConvertor.php


示例20: removeListing

 /**
  * @param Listing $listing
  * @throws \Exception
  */
 public function removeListing(Listing $listing)
 {
     try {
         $this->em->remove($listing)->flush();
     } catch (\Exception $e) {
         $this->onCritical(sprintf('Removal of Listing #id(%s) failed. [%s]', $listing->getId(), 'removeListing'), $e, self::class);
         throw $e;
     }
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:13,代码来源:ListingsWriter.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP payload\Found类代码示例发布时间:2022-05-23
下一篇:
PHP widgets\Select2类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap