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


PHP PersistenceManagerInterface::add方法代码示例

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


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

示例1: add

 /**
  * Adds an object to this repository.
  *
  * @param object $object The object to add
  * @return void
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  * @api
  */
 public function add($object)
 {
     if (!is_object($object) || !$object instanceof $this->entityClassName) {
         $type = is_object($object) ? get_class($object) : gettype($object);
         throw new \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
     }
     $this->persistenceManager->add($object);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:16,代码来源:Repository.php

示例2: getResourcePointerForHash

 /**
  * Helper function which creates or fetches a resource pointer object for a given hash.
  *
  * If a ResourcePointer with the given hash exists, this one is used. Else, a new one
  * is created. This is a workaround for missing ValueObject support in Doctrine.
  *
  * @param string $hash
  * @return \TYPO3\Flow\Resource\ResourcePointer
  */
 public function getResourcePointerForHash($hash)
 {
     $resourcePointer = $this->persistenceManager->getObjectByIdentifier($hash, 'TYPO3\\Flow\\Resource\\ResourcePointer');
     if (!$resourcePointer) {
         $resourcePointer = new \TYPO3\Flow\Resource\ResourcePointer($hash);
         $this->persistenceManager->add($resourcePointer);
     }
     return $resourcePointer;
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:18,代码来源:ResourceManager.php

示例3: persistEntities

 /**
  * Checks if a propertyValue contains an entity and persists it.
  *
  * @param mixed $propertyValue
  * @return void
  */
 protected function persistEntities($propertyValue)
 {
     if (!$propertyValue instanceof \Iterator && !is_array($propertyValue)) {
         $propertyValue = array($propertyValue);
     }
     foreach ($propertyValue as $possibleEntity) {
         if (is_object($possibleEntity) && $possibleEntity instanceof \TYPO3\Flow\Persistence\Aspect\PersistenceMagicInterface) {
             $this->persistenceManager->isNewObject($possibleEntity) ? $this->persistenceManager->add($possibleEntity) : $this->persistenceManager->update($possibleEntity);
             // TODO: Needed because the originalAsset will not cascade persist. We should find a generic solution to this.
             if ($possibleEntity instanceof ImageVariant) {
                 $asset = $possibleEntity->getOriginalAsset();
                 $this->persistenceManager->isNewObject($asset) ? $this->persistenceManager->add($asset) : $this->persistenceManager->update($asset);
             }
         }
     }
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:22,代码来源:NodeImportService.php

示例4: persistRelatedEntities

 /**
  * Checks if a property value contains an entity and persists it.
  *
  * @param mixed $value
  */
 protected function persistRelatedEntities($value)
 {
     if (!is_array($value) && !$value instanceof \Iterator) {
         $value = array($value);
     }
     foreach ($value as $element) {
         if (is_object($element) && $element instanceof PersistenceMagicInterface) {
             $this->persistenceManager->isNewObject($element) ? $this->persistenceManager->add($element) : $this->persistenceManager->update($element);
         }
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:16,代码来源:AbstractNodeData.php

示例5: addObjectToPersistence

 /**
  * @param object $object
  * @return void
  */
 protected function addObjectToPersistence($object)
 {
     $this->persistenceManager->add($object);
 }
开发者ID:HofUniversityIWS,项目名称:backend,代码行数:8,代码来源:FixtureFactory.php


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