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


PHP ClassMetadataInfo::isIdentifierNatural方法代碼示例

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


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

示例1: getFieldsFromMetadata

 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param  ClassMetadataInfo $metadata
  * @return array             $fields
  */
 private function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = (array) $metadata->fieldMappings;
     // Remove the primary key field if it's not managed manually
     if (!$metadata->isIdentifierNatural()) {
         foreach ($metadata->identifier as $id) {
             if (array_key_exists($id, $fields)) {
                 unset($fields[$id]);
             }
         }
     }
     return $fields;
 }
開發者ID:reiarseni,項目名稱:AdminCrudBundle,代碼行數:20,代碼來源:MWSimpleFormGenerator.php

示例2: getFieldsFromMetadata

 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param  ClassMetadataInfo $metadata
  * @return array             $fields
  */
 private function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = (array) $metadata->fieldNames;
     // Remove the primary key field if it's not managed manually
     if (!$metadata->isIdentifierNatural()) {
         $fields = array_diff($fields, $metadata->identifier);
     }
     foreach ($metadata->associationMappings as $fieldName => $relation) {
         if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
             $fields[] = $fieldName;
         }
     }
     return $fields;
 }
開發者ID:kassner,項目名稱:generator-bundle,代碼行數:21,代碼來源:DoctrineCrudGenerator.php

示例3: getFieldsFromMetadata

 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param ClassMetadataInfo $metadata
  *
  * @return array $fields
  */
 private function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = (array) $metadata->fieldNames;
     if (!$metadata->isIdentifierNatural()) {
         $fields = array_diff($fields, $metadata->identifier);
     }
     $fieldsMapping = array();
     foreach ($fields as $field) {
         $fieldsMapping[$field] = $metadata->getTypeOfField($field);
     }
     foreach ($metadata->associationMappings as $fieldName => $relation) {
         if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
             $fieldsMapping[$fieldName] = 'relation';
         }
     }
     return $fieldsMapping;
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:25,代碼來源:DefaultFormFactory.php

示例4: getFieldsFromMetadata

 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param ClassMetadataInfo $metadata
  *
  * @return array $fields
  */
 private function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = $this->tplOptions['fields'];
     foreach ($fields as $field => $null) {
         if (in_array($field, $this->ignoreFeilds)) {
             unset($fields[$field]);
         }
     }
     foreach ($fields as &$field) {
         if (in_array($field['type'], ['date', 'datetime', 'dateinterval', 'string_array', 'integer_array'])) {
             $field['formType'] = $field['type'];
         }
     }
     if (!$metadata->isIdentifierNatural()) {
         foreach ($metadata->identifier as $id) {
             unset($fields[$id]);
         }
     }
     foreach ($metadata->associationMappings as $fieldName => $relation) {
         if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
             $label = preg_replace('/([A-Z])/', ' \\1', $fieldName);
             $label = trim($label);
             $label = strtolower($label);
             $label = ucfirst($label);
             $fields[$fieldName] = ['fieldName' => $fieldName, 'type' => $relation['targetEntity'], 'columnName' => $fieldName, 'length' => null, 'nullable' => '', 'label' => $label, 'columnNameSize' => strlen($fieldName), 'formType' => 'objectChoice'];
         }
     }
     foreach ($fields as &$field) {
         $entityBundle = '\\' . $this->tplOptions['entity_bundle_ns'];
         $type = $field['type'];
         if (strpos($type, 'Entity', 0)) {
             $type = '\\' . $type;
         }
         if (strpos($type, $entityBundle, 0) === 0) {
             $type = str_replace($entityBundle . '\\', '', $type);
             $type = '@var ' . $type;
         }
         $field['formTypeHint'] = "/* {$type} */";
     }
     return $fields;
 }
開發者ID:turnaev,項目名稱:dev-generator-tool-bundle,代碼行數:49,代碼來源:DoctrineFormGenerator.php

示例5: getFieldsFromMetadata

 /**
  * Returns an array of fields. Fields can be both column fields and
  * association fields.
  *
  * @param  ClassMetadataInfo $metadata
  * @return array             $fields
  */
 protected function getFieldsFromMetadata(ClassMetadataInfo $metadata)
 {
     $fields = array_merge($metadata->fieldMappings, $metadata->associationMappings);
     // Remove the primary key field if it's not managed manually
     if (!$metadata->isIdentifierNatural()) {
         foreach ($metadata->identifier as $identifier) {
             unset($fields[$identifier]);
         }
     }
     foreach ($metadata->associationMappings as $fieldName => $relation) {
         $multiTypes = array(ClassMetadataInfo::ONE_TO_MANY, ClassMetadataInfo::MANY_TO_MANY);
         if (in_array($relation['type'], $multiTypes)) {
             $fields[$fieldName]['relatedType'] = 'many';
         } else {
             $fields[$fieldName]['relatedType'] = 'single';
         }
         $fields[$fieldName]['relatedEntityShortcut'] = $this->getEntityBundleShortcut($fields[$fieldName]['targetEntity']);
     }
     return $fields;
 }
開發者ID:stopfstedt,項目名稱:TdnPilotBundle,代碼行數:27,代碼來源:Generator.php


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