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


PHP PersistentCollection::getTypeClass方法代码示例

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


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

示例1: _collectJoinTableColumnParameters

 /**
  * Collects the parameters for inserting/deleting on the join table in the order
  * of the join table columns as specified in ManyToManyMapping#joinTableColumns.
  *
  * @param $coll
  * @param $element
  * @return array
  */
 private function _collectJoinTableColumnParameters(PersistentCollection $coll, $element)
 {
     $params = array();
     $mapping = $coll->getMapping();
     $isComposite = count($mapping['joinTableColumns']) > 2;
     $identifier1 = $this->_uow->getEntityIdentifier($coll->getOwner());
     $identifier2 = $this->_uow->getEntityIdentifier($element);
     if ($isComposite) {
         $class1 = $this->_em->getClassMetadata(get_class($coll->getOwner()));
         $class2 = $coll->getTypeClass();
     }
     foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
         if (isset($mapping['relationToSourceKeyColumns'][$joinTableColumn])) {
             if ($isComposite) {
                 if ($class1->containsForeignIdentifier) {
                     $params[] = $identifier1[$class1->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])];
                 } else {
                     $params[] = $identifier1[$class1->fieldNames[$mapping['relationToSourceKeyColumns'][$joinTableColumn]]];
                 }
             } else {
                 $params[] = array_pop($identifier1);
             }
         } else {
             if ($isComposite) {
                 if ($class2->containsForeignIdentifier) {
                     $params[] = $identifier2[$class2->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])];
                 } else {
                     $params[] = $identifier2[$class2->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]];
                 }
             } else {
                 $params[] = array_pop($identifier2);
             }
         }
     }
     return $params;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:44,代码来源:ManyToManyPersister.php

示例2: collectJoinTableColumnParameters

 /**
  * Collects the parameters for inserting/deleting on the join table in the order
  * of the join table columns as specified in ManyToManyMapping#joinTableColumns.
  *
  * @param \Doctrine\ORM\PersistentCollection $coll
  * @param object                             $element
  *
  * @return array
  */
 private function collectJoinTableColumnParameters(PersistentCollection $coll, $element)
 {
     $params = array();
     $mapping = $coll->getMapping();
     $isComposite = count($mapping['joinTableColumns']) > 2;
     $identifier1 = $this->uow->getEntityIdentifier($coll->getOwner());
     $identifier2 = $this->uow->getEntityIdentifier($element);
     if ($isComposite) {
         $class1 = $this->em->getClassMetadata(get_class($coll->getOwner()));
         $class2 = $coll->getTypeClass();
     }
     foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
         $isRelationToSource = isset($mapping['relationToSourceKeyColumns'][$joinTableColumn]);
         if (!$isComposite) {
             $params[] = $isRelationToSource ? array_pop($identifier1) : array_pop($identifier2);
             continue;
         }
         if ($isRelationToSource) {
             $params[] = $identifier1[$class1->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])];
             continue;
         }
         $params[] = $identifier2[$class2->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])];
     }
     return $params;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:34,代码来源:ManyToManyPersister.php

示例3: getClassName

 /**
  * Gets the real fully-qualified class name of the given object (even if its a proxy).
  *
  * @param string|object|array|PersistentCollection $object
  * @return string
  * @throws RuntimeException
  */
 public function getClassName($object)
 {
     if ($object instanceof PersistentCollection) {
         $className = $object->getTypeClass()->getName();
     } elseif (is_string($object)) {
         $className = ClassUtils::getRealClass($object);
     } elseif (is_object($object)) {
         $className = ClassUtils::getClass($object);
     } elseif (is_array($object) && count($object) && is_object(reset($object))) {
         $className = ClassUtils::getClass(reset($object));
     } else {
         $className = $object;
     }
     if (!is_string($className)) {
         throw new RuntimeException(sprintf('ConfigProvider::getClassName expects Object, ' . 'PersistentCollection, array of entities or string. "%s" given', gettype($className)));
     }
     return $className;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:25,代码来源:ConfigProvider.php


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