當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityManager::getMetadataFactory方法代碼示例

本文整理匯總了PHP中Kdyby\Doctrine\EntityManager::getMetadataFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityManager::getMetadataFactory方法的具體用法?PHP EntityManager::getMetadataFactory怎麽用?PHP EntityManager::getMetadataFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Kdyby\Doctrine\EntityManager的用法示例。


在下文中一共展示了EntityManager::getMetadataFactory方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $schemaTool = new Doctrine\ORM\Tools\SchemaTool($this->em);
         $schemaTool->updateSchema($this->em->getMetadataFactory()->getAllMetadata());
         $output->writeLn('<info>[OK] - BLOG:UPDATE</info>');
         return 0;
         // zero return code means everything is ok
     } catch (\Exception $exc) {
         $output->writeLn('<error>BLOG:UPDATE - ' . $exc->getMessage() . '</error>');
         return 1;
         // non-zero return code means error
     }
 }
開發者ID:krausv,項目名稱:www.zeminem.cz,代碼行數:14,代碼來源:BlogUpdate.php

示例3: setIdentity

 /**
  * Sets the user identity.
  * @return UserStorage Provides a fluent interface
  */
 public function setIdentity(IIdentity $identity = null)
 {
     if ($identity !== NULL) {
         $class = get_class($identity);
         // we want to convert identity entities into fake identity
         // so only the identifier fields are stored,
         // but we are only interested in identities which are correctly
         // mapped as doctrine entities
         if ($this->entityManager->getMetadataFactory()->hasMetadataFor($class)) {
             $cm = $this->entityManager->getClassMetadata($class);
             $identifier = $cm->getIdentifierValues($identity);
             $identity = new FakeIdentity($identifier, $class);
         }
     }
     return parent::setIdentity($identity);
 }
開發者ID:blitzik,項目名稱:vycetky-doctrine,代碼行數:20,代碼來源:UserStorage.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $schemaTool = new Doctrine\ORM\Tools\SchemaTool($this->em);
         $schemaTool->createSchema($this->em->getMetadataFactory()->getAllMetadata());
         $post = new Entity\Post();
         $post->title = 'Vítejte na svém novém blogu!';
         $post->slug = 'vitejte-na-svem-novem-blogu';
         $post->body = 'Instalace proběhla úspěšně. Jupí! (-:';
         $post->date = new \DateTime();
         $post->publish_date = new \DateTime();
         $this->em->persist($post);
         $this->em->flush();
         $output->writeLn('<info>[OK] - BLOG:INSTALL</info>');
         return 0;
         // zero return code means everything is ok
     } catch (\Exception $exc) {
         $output->writeLn('<error>BLOG:INSTALL - ' . $exc->getMessage() . '</error>');
         return 1;
         // non-zero return code means error
     }
 }
開發者ID:krausv,項目名稱:www.zeminem.cz,代碼行數:22,代碼來源:BlogInstall.php


注:本文中的Kdyby\Doctrine\EntityManager::getMetadataFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。