當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。