当前位置: 首页>>代码示例>>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;未经允许,请勿转载。