‪TYPO3CMS  10.4
AbstractFileCollectionConverter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 
32 {
36  protected ‪$priority = 10;
37 
41  protected ‪$expectedObjectType;
42 
46  protected ‪$fileFactory;
47 
52  {
53  $this->fileFactory = ‪$fileFactory;
54  }
55 
67  public function ‪convertFrom($source, string ‪$targetType, array $convertedChildProperties = [], ‪PropertyMappingConfigurationInterface $configuration = null): ‪AbstractFileCollection
68  {
69  $object = $this->‪getObject($source);
70  if (empty($this->expectedObjectType) || !$object instanceof $this->expectedObjectType) {
71  throw new ‪Exception('Expected object of type "' . $this->expectedObjectType . '" but got ' . get_class($object), 1342895976);
72  }
74  $subject = $this->objectManager->get(‪$targetType);
75  $subject->setObject($object);
76  return $subject;
77  }
78 
84 }
‪TYPO3\CMS\Extbase\Property\Exception
Definition: DuplicateObjectException.php:18
‪TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection
Definition: AbstractFileCollection.php:27
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\injectFileFactory
‪injectFileFactory(ResourceFactory $fileFactory)
Definition: AbstractFileCollectionConverter.php:48
‪TYPO3
‪TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface
Definition: PropertyMappingConfigurationInterface.php:22
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\getObject
‪TYPO3 CMS Core Resource Collection AbstractFileCollection getObject($source)
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter\$targetType
‪string $targetType
Definition: AbstractTypeConverter.php:45
‪TYPO3\CMS\Extbase\Property\TypeConverter
Definition: AbstractFileCollectionConverter.php:18
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:41
‪TYPO3\CMS\Extbase\Property\Exception
Definition: Exception.php:26
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\$fileFactory
‪TYPO3 CMS Core Resource ResourceFactory $fileFactory
Definition: AbstractFileCollectionConverter.php:43
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter
Definition: AbstractTypeConverter.php:34
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\convertFrom
‪TYPO3 CMS Extbase Domain Model AbstractFileCollection convertFrom($source, string $targetType, array $convertedChildProperties=[], PropertyMappingConfigurationInterface $configuration=null)
Definition: AbstractFileCollectionConverter.php:64
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\$priority
‪int $priority
Definition: AbstractFileCollectionConverter.php:35
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter
Definition: AbstractFileCollectionConverter.php:32
‪TYPO3\CMS\Extbase\Domain\Model\AbstractFileCollection
Definition: AbstractFileCollection.php:27
‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFileCollectionConverter\$expectedObjectType
‪string $expectedObjectType
Definition: AbstractFileCollectionConverter.php:39