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


PHP ClassUtils::generateProxyClassName方法代碼示例

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


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

示例1: createProxyDefinition

 public function createProxyDefinition($className)
 {
     $classMetadata = $this->metadataFactory->getMetadataFor($className);
     $reflectionFields = $classMetadata->getReflectionFields();
     $reflectionId = $reflectionFields[$classMetadata->getRidPropertyName()];
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->proxyNamespace), $classMetadata->getIdentifierFieldNames(), $classMetadata->getReflectionFields(), $this->createInitializer($classMetadata, $this->uow->getHydrator(), $reflectionId), $this->createCloner($classMetadata, $this->uow->getHydrator(), $reflectionId));
 }
開發者ID:doctrine,項目名稱:orientdb-odm,代碼行數:7,代碼來源:ProxyFactory.php

示例2: createProxyDefinition

 /**
  * @param string $className
  *
  * @return ProxyDefinition
  * @throws FetchException
  */
 protected function createProxyDefinition($className)
 {
     /** @var EntityMetadata $classMetadata */
     $classMetadata = $this->manager->getClassMetadata($className);
     /** @var ApiPersister $persister */
     $persister = $this->uow->getEntityPersister($className);
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->manager->getConfiguration()->getProxyNamespace()), $classMetadata->getIdentifierFieldNames(), $classMetadata->getReflectionProperties(), $this->createInitializer($classMetadata, $persister), $this->createCloner($classMetadata, $persister));
 }
開發者ID:bankiru,項目名稱:doctrine-api-client,代碼行數:14,代碼來源:ProxyFactory.php

示例3: createProxyDefinition

 /**
  * @inheritdoc
  */
 public function createProxyDefinition($className)
 {
     /** @var ClassMetadata $classMetadata */
     $classMetadata = $this->metadataFactory->getMetadataFor($className);
     $documentPersister = $this->uow->getDocumentPersister($className);
     $reflectionFields = $classMetadata->getReflectionProperties();
     $reflectionId = $reflectionFields[$classMetadata->getRidPropertyName()];
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->proxyNamespace), $classMetadata->getIdentifierFieldNames(), $reflectionFields, $this->createInitializer($classMetadata, $documentPersister, $reflectionId), $this->createCloner($classMetadata, $documentPersister, $reflectionId));
 }
開發者ID:Edencia,項目名稱:orientdb-php-odm,代碼行數:12,代碼來源:ProxyFactory.php

示例4: createProxyDefinition

 /**
  * {@inheritDoc}
  */
 protected function createProxyDefinition($className)
 {
     $cm = $this->em->getClassMetadata($className);
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->proxyNamespace), $cm->getIdentifierFieldNames(), $cm->getReflectionProperties(), function (BaseProxy $proxy) use($cm) {
         if ($proxy->__isInitialized()) {
             return;
         }
     }, function (BaseProxy $proxy) use($cm) {
         if ($proxy->__isInitialized()) {
             return;
         }
     });
 }
開發者ID:pasinter,項目名稱:redis-ohm,代碼行數:16,代碼來源:ProxyFactory.php

示例5: generateNamespace

 /**
  * Generates the proxy namespace.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class
  *
  * @return string
  */
 private function generateNamespace(ClassMetadata $class)
 {
     $proxyClassName = ClassUtils::generateProxyClassName($class->getName(), $this->proxyNamespace);
     $parts = explode('\\', strrev($proxyClassName), 2);
     return strrev($parts[1]);
 }
開發者ID:BusinessCookies,項目名稱:CoffeeMachineProject,代碼行數:13,代碼來源:ProxyGenerator.php

示例6: _generateProxyClass

 /**
  * Generates a proxy class file.
  *
  * @param ClassMetadata $class Metadata for the original class
  * @param string $fileName Filename (full path) for the generated class
  * @param string $file The proxy class template data
  */
 private function _generateProxyClass(ClassMetadata $class, $fileName, $file)
 {
     $methods = $this->_generateMethods($class);
     $sleepImpl = $this->_generateSleep($class);
     $cloneImpl = $class->reflClass->hasMethod('__clone') ? 'parent::__clone();' : '';
     // hasMethod() checks case-insensitive
     $placeholders = array('<namespace>', '<proxyClassName>', '<className>', '<methods>', '<sleepImpl>', '<cloneImpl>');
     $className = ltrim($class->name, '\\');
     $proxyClassName = ClassUtils::generateProxyClassName($class->name, $this->_proxyNamespace);
     $parts = explode('\\', strrev($proxyClassName), 2);
     $proxyClassNamespace = strrev($parts[1]);
     $proxyClassName = strrev($parts[0]);
     $replacements = array($proxyClassNamespace, $proxyClassName, $className, $methods, $sleepImpl, $cloneImpl);
     $file = str_replace($placeholders, $replacements, $file);
     $parentDirectory = dirname($fileName);
     if (!is_dir($parentDirectory)) {
         if (false === @mkdir($parentDirectory, 0775, true)) {
             throw ProxyException::proxyDirectoryNotWritable();
         }
     } else {
         if (!is_writable($parentDirectory)) {
             throw ProxyException::proxyDirectoryNotWritable();
         }
     }
     $tmpFileName = $fileName . '.' . uniqid("", true);
     file_put_contents($tmpFileName, $file);
     rename($tmpFileName, $fileName);
 }
開發者ID:laiello,項目名稱:masfletes,代碼行數:35,代碼來源:ProxyFactory.php

示例7: createProxyDefinition

 /**
  * {@inheritDoc}
  */
 protected function createProxyDefinition($className)
 {
     $classMetadata = $this->em->getClassMetadata($className);
     $entityPersister = $this->uow->getEntityPersister($className);
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->proxyNs), $classMetadata->getIdentifierFieldNames(), $classMetadata->getReflectionProperties(), $this->createInitializer($classMetadata, $entityPersister), $this->createCloner($classMetadata, $entityPersister));
 }
開發者ID:6975usa,項目名稱:doctrine,代碼行數:9,代碼來源:ProxyFactory.php

示例8: generateProxyClass

 /**
  * Generates a proxy class file.
  *
  * @param $class
  * @param $fileName
  * @param $template
  */
 private function generateProxyClass($class, $fileName, $template)
 {
     $methods = $this->generateMethods($class);
     $sleepImpl = $this->generateSleep($class);
     $placeholders = array('<namespace>', '<proxyClassName>', '<className>', '<methods>', '<sleepImpl>');
     $className = ltrim($class->name, '\\');
     $proxyClassName = ClassUtils::generateProxyClassName($class->name, $this->proxyNamespace);
     $parts = explode('\\', strrev($proxyClassName), 2);
     $proxyClassNamespace = strrev($parts[1]);
     $proxyClassName = strrev($parts[0]);
     $replacements = array($proxyClassNamespace, $proxyClassName, $className, $methods, $sleepImpl);
     $template = str_replace($placeholders, $replacements, $template);
     file_put_contents($fileName, $template, LOCK_EX);
 }
開發者ID:ngroot,項目名稱:couchdb-odm,代碼行數:21,代碼來源:ProxyFactory.php

示例9: createProxyDefinition

 /**
  * {@inheritDoc}
  */
 public function createProxyDefinition($className)
 {
     /* @var $classMetadata \Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo */
     $classMetadata = $this->metadataFactory->getMetadataFor($className);
     $documentPersister = $this->uow->getDocumentPersister($className);
     $reflectionId = $classMetadata->reflFields[$classMetadata->identifier];
     return new ProxyDefinition(ClassUtils::generateProxyClassName($className, $this->proxyNamespace), $classMetadata->getIdentifierFieldNames(), $classMetadata->getReflectionProperties(), $this->createInitializer($classMetadata, $documentPersister, $reflectionId), $this->createCloner($classMetadata, $documentPersister, $reflectionId));
 }
開發者ID:briareos,項目名稱:mongodb-odm,代碼行數:11,代碼來源:ProxyFactory.php

示例10: createProxyDefinition

 /**
  * {@inheritDoc}
  */
 protected function createProxyDefinition($className)
 {
     $classMetadata = $this->documentManager->getClassMetadata($className);
     return new ProxyDefinition(ClassUtils::generateProxyClassName($classMetadata->getName(), $this->proxyNamespace), array($classMetadata->identifier), $classMetadata->reflFields, $this->createInitializer($classMetadata), $this->createCloner($classMetadata, $classMetadata->reflFields[$classMetadata->identifier]));
 }
開發者ID:nikophil,項目名稱:cmf-tests,代碼行數:8,代碼來源:ProxyFactory.php

示例11: testGenerateProxyClassName

 public function testGenerateProxyClassName()
 {
     $this->assertEquals('Proxies\\__CG__\\stdClass', ClassUtils::generateProxyClassName('stdClass', 'Proxies'));
 }
開發者ID:manhvu1212,項目名稱:videoplatform,代碼行數:4,代碼來源:ClassUtilsTest.php

示例12: _generateProxyClass

 /**
  * Generates a proxy class file.
  *
  * @param $class
  * @param $proxyClassName
  * @param $file The path of the file to write to.
  */
 private function _generateProxyClass($class, $fileName, $file)
 {
     $methods = $this->_generateMethods($class);
     $sleepImpl = $this->_generateSleep($class);
     $cloneImpl = $class->reflClass->hasMethod('__clone') ? 'parent::__clone();' : '';
     // hasMethod() checks case-insensitive
     $placeholders = array('<namespace>', '<proxyClassName>', '<className>', '<methods>', '<sleepImpl>', '<cloneImpl>');
     $className = ltrim($class->name, '\\');
     $proxyClassName = ClassUtils::generateProxyClassName($class->name, $this->_proxyNamespace);
     $parts = explode('\\', strrev($proxyClassName), 2);
     $proxyClassNamespace = strrev($parts[1]);
     $proxyClassName = strrev($parts[0]);
     $replacements = array($proxyClassNamespace, $proxyClassName, $className, $methods, $sleepImpl, $cloneImpl);
     $file = str_replace($placeholders, $replacements, $file);
     file_put_contents($fileName, $file, LOCK_EX);
 }
開發者ID:nicoBrossault,項目名稱:theDogsCrew-admin,代碼行數:23,代碼來源:ProxyFactory.php

示例13: createProxyDefinition

 /**
  * {@inheritDoc}
  */
 protected function createProxyDefinition($className)
 {
     $classMetadata = $this->documentManager->getClassMetadata($className);
     if ($classMetadata->identifier) {
         $identifierFields = array($classMetadata->identifier);
         $reflectionId = $classMetadata->reflFields[$classMetadata->identifier];
     } else {
         $identifierFields = array();
         $reflectionId = null;
     }
     return new ProxyDefinition(ClassUtils::generateProxyClassName($classMetadata->getName(), $this->proxyNamespace), $identifierFields, $classMetadata->reflFields, $this->createInitializer($classMetadata), $this->createCloner($classMetadata, $reflectionId));
 }
開發者ID:steffenbrem,項目名稱:phpcr-odm,代碼行數:15,代碼來源:ProxyFactory.php


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