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


PHP Doctrine::getEntityManager方法代码示例

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


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

示例1: __construct

 /**
  * Class constructor
  * 
  * @param string $action
  * @param mixed $urlvalues
  */
 public function __construct($action, $urlvalues)
 {
     $this->action = $action;
     $this->urlvalues = $urlvalues;
     // initialize the entityManage to be use by all child classes(Controller)
     $this->entityManager = Doctrine::getEntityManager();
 }
开发者ID:jackbob2,项目名称:jackbob,代码行数:13,代码来源:BaseController.class.php

示例2: getEntityManager

 /**
  * Возвращает EntityManager
  * @param bool $smart
  * @param string $path_to_entity
  * @param string $proxyPath
  * @param string $proxyNamespace
  * @return \Doctrine\ORM\EntityManager
  */
 public static function getEntityManager($smart = FALSE, $path_to_entity = null, $proxyPath = null, $proxyNamespace = null)
 {
     return Doctrine::getEntityManager($smart, $path_to_entity, $proxyPath, $proxyNamespace);
 }
开发者ID:php-nik,项目名称:sokol,代码行数:12,代码来源:BaseModel.php

示例3: getNextQuestion

 /**
  * Получает следующий вопрос, жаль что приходится в этом случае использовать нативный sql, но без него нормально не сделать
  * @param Request $request
  * @param Doctrine $doctrine
  * @return array | bool true если вопросы закончились
  */
 public static function getNextQuestion($request, $doctrine)
 {
     $session = $request->getSession();
     $n = $session->get(self::CURRENT_QUESTION);
     //если заданы все вопросы, вернуть true
     if ($n == self::QUESTIONS_LIMIT) {
         return true;
     }
     $result = array();
     $notIn = $session->get(self::LAST_QUESTIONS, array(0));
     $sNotIn = join(',', $notIn);
     $rsm = new ResultSetMapping();
     $rsm->addEntityResult('SkyengTT\\SkyengTTBundle\\Entity\\Vocabulary', 'v');
     $rsm->addFieldResult('v', 'id', 'id');
     $rsm->addFieldResult('v', 'eng_word', 'eng_word');
     $rsm->addFieldResult('v', 'rus_word', 'rus_word');
     $rsm->addFieldResult('v', 'answer_id', 'answer_id');
     $questionResult = $doctrine->getEntityManager()->createNativeQuery("SELECT v.id, v.eng_word, v.rus_word, v.answer_id FROM vocabulary AS v WHERE v.id NOT IN ({$sNotIn}) ORDER BY RANDOM() LIMIT 1", $rsm)->getResult();
     $answerLangWord = 'getRusWord';
     $questionLangWord = 'getEngWord';
     if (rand(0, 1000) % 2 != 0) {
         $buf = $answerLangWord;
         $answerLangWord = $questionLangWord;
         $questionLangWord = $buf;
     }
     if ($questionResult) {
         $question = current($questionResult);
         $questionId = $question->getId();
         $notIn[$questionId] = $questionId;
         $session->set(self::LAST_QUESTIONS, $notIn);
         $answerResult = $doctrine->getEntityManager()->createNativeQuery("SELECT v.id, v.eng_word, v.rus_word, v.answer_id FROM vocabulary AS v WHERE id != {$questionId} ORDER BY RANDOM() LIMIT 4", $rsm)->getResult();
         $result['answers'] = array();
         $result['question'] = array('id' => $question->getId(), 'word' => $question->{$questionLangWord}());
         foreach ($answerResult as $item) {
             if ($item->getId() != $question->getId()) {
                 $result['answers'][] = array('word' => $item->{$answerLangWord}(), 'id' => $item->getAnswerId());
             }
         }
         $k = rand(0, 3);
         $result['answers'][$k] = array('word' => $question->{$answerLangWord}(), 'id' => $question->getAnswerId());
     }
     $session->set(self::CURRENT_QUESTION, $n + 1);
     return $result;
 }
开发者ID:lamzin-andrey,项目名称:skyengtt.loc,代码行数:50,代码来源:AppLib.php

示例4: __construct

 public function __construct(Doctrine $doctrine)
 {
     $this->em = $doctrine->getEntityManager();
 }
开发者ID:Jon1367,项目名称:symfony2Project,代码行数:4,代码来源:ContentValidate.php

示例5: fromQuery

 /**
  * Creates pager from query builder or query
  *
  * @param QueryBuilder $qb
  * @param ParameterBag $params
  * 
  * @return Pager
  */
 public function fromQuery(QueryBuilder $qb, ParameterBag $params)
 {
     return $this->getNewPager($params, $this->doctrine->getEntityManager())->setQueryBuilder($qb);
 }
开发者ID:Borales,项目名称:HatimeriaExtJSBundle,代码行数:12,代码来源:PagerFactory.php


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