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


PHP MappingException::oneToManyRequiresMappedBy方法代碼示例

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


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

示例1: _validateAndCompleteOneToManyMapping

 /**
  * Validates and completes the mapping.
  *
  * @param array $mapping The mapping to validate and complete.
  * @throws MappingException
  * @throws InvalidArgumentException
  * @return array The validated and completed mapping.@override
  */
 protected function _validateAndCompleteOneToManyMapping(array $mapping)
 {
     $mapping = $this->_validateAndCompleteAssociationMapping($mapping);
     // OneToMany-side MUST be inverse (must have mappedBy)
     if (!isset($mapping['mappedBy'])) {
         throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
     }
     $mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
     $mapping['isCascadeRemove'] = $mapping['orphanRemoval'] ? true : $mapping['isCascadeRemove'];
     if (isset($mapping['orderBy'])) {
         if (!is_array($mapping['orderBy'])) {
             throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy']));
         }
     }
     return $mapping;
 }
開發者ID:alexanderwsp-git,項目名稱:columbus,代碼行數:24,代碼來源:ClassMetadataInfo.php

示例2: _validateAndCompleteOneToManyMapping

 /**
  * Validates & completes a one-to-many association mapping.
  *
  * @param array $mapping The mapping to validate and complete.
  *
  * @return array The validated and completed mapping.
  *
  * @throws MappingException
  * @throws InvalidArgumentException
  */
 protected function _validateAndCompleteOneToManyMapping(array $mapping)
 {
     $mapping = $this->_validateAndCompleteAssociationMapping($mapping);
     // OneToMany-side MUST be inverse (must have mappedBy)
     if (!isset($mapping['mappedBy'])) {
         throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
     }
     $mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) && $mapping['orphanRemoval'];
     $mapping['isCascadeRemove'] = $mapping['orphanRemoval'] || $mapping['isCascadeRemove'];
     $this->assertMappingOrderBy($mapping);
     return $mapping;
 }
開發者ID:AdactiveSAS,項目名稱:doctrine2,代碼行數:22,代碼來源:ClassMetadataInfo.php


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