Esempio n. 1
0
 /**
  * @test
  */
 public function executeReturnsRawObjectDataIfReturnRawQueryResultIsSet()
 {
     $this->persistenceManager->expects($this->once())->method('getObjectDataByQuery')->with($this->query)->will($this->returnValue('rawQueryResult'));
     $expectedResult = 'rawQueryResult';
     $actualResult = $this->query->execute(true);
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @param Typo3OrgSsoToken $authenticationToken
  * @return bool
  */
 public function authenticate(Typo3OrgSsoToken $authenticationToken)
 {
     /** @var $account FrontendUser */
     $account = null;
     $credentials = $authenticationToken->getCredentials();
     if (is_array($credentials) && isset($credentials['username'])) {
         $account = $this->frontendUserRepository->findOneByUsername($credentials['username']);
     }
     $authenticated = false;
     $authenticationData = 'version=' . $credentials['version'] . '&user='******'username'] . '&tpa_id=' . $credentials['tpaId'] . '&expires=' . $credentials['expires'] . '&action=' . $credentials['action'] . '&flags=' . $credentials['flags'] . '&userdata=' . $credentials['userdata'];
     $authenticationDataIsValid = $this->verifySignature($authenticationData, $credentials['signature']);
     if ($authenticationDataIsValid && $credentials['expires'] > time()) {
         $userdata = $this->parseUserdata($credentials['userdata']);
         if (!is_object($account)) {
             $account = $this->createAccount($userdata);
             $this->frontendUserRepository->add($account);
         } elseif (is_object($account)) {
             $account = $this->updateAccount($account, $userdata);
             $this->frontendUserRepository->update($account);
         }
         $this->persistenceManager->persistAll();
         $this->authenticationService->registerSession($account);
         $authenticated = true;
     }
     return $authenticated;
 }
Esempio n. 3
0
 /**
  * @param array $entry
  *
  * @return int|void
  */
 public function processEntry(array $entry)
 {
     $configuration = $this->getConfiguration();
     $this->repository = $this->objectManager->get($configuration['repository']);
     $model = $this->mapModel($this->getModel(), $configuration['mapping'], $entry);
     $this->repository->add($model);
     $this->persistenceManager->persistAll();
     if (isset($configuration['language']) && is_array($configuration['language'])) {
         $this->processLanguageEntries($configuration['language'], $model, $entry);
     }
     $this->persistenceManager->persistAll();
     return TargetInterface::RESULT_INSERT;
 }
 /**
  * Sets up this test case
  *
  * @return void
  */
 protected function setUp()
 {
     $this->query = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Query::class, array('dummy'), array('someType'));
     $this->querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
     $this->query->_set('querySettings', $this->querySettings);
     $this->persistenceManager = $this->getMock(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface::class);
     $this->backend = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface::class);
     $this->backend->expects($this->any())->method('getQomFactory')->will($this->returnValue(null));
     $this->persistenceManager->expects($this->any())->method('getBackend')->will($this->returnValue($this->backend));
     $this->query->_set('persistenceManager', $this->persistenceManager);
     $this->dataMapper = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class);
     $this->query->_set('dataMapper', $this->dataMapper);
     $this->controller = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\PaginateController::class, array('dummy'), array(), '', false);
     $this->controller->_set('view', $this->getMock(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class));
 }
 /**
  * Creates a new entity of the given type and relates it with the given imported record.
  *
  * @param RepositoryInterface $repository
  * @param string $entityClass
  * @param array $importedRecord
  * @return \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
  */
 protected function createEntityAndStoreImportedUid($repository, $entityClass, array $importedRecord)
 {
     $entity = $this->objectManager->get($entityClass);
     if (!$entity instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractEntity) {
         throw new \RuntimeException('The entity class must be an instance of AbstractEntity');
     }
     if (isset($importedRecord['pid'])) {
         $entity->setPid($importedRecord['pid']);
     }
     $repository->add($entity);
     $this->persistenceManager->persistAll();
     $entityTableName = $this->dataMapper->getDataMap($entityClass)->getTableName();
     $this->getDatabaseConnection()->exec_UPDATEquery($entityTableName, 'uid=' . (int) $entity->getUid(), ['tx_czsimplecalimportercal_imported_uid' => (int) $importedRecord['uid']]);
     return $entity;
 }
Esempio n. 6
0
 public function setUp()
 {
     $this->mockIdentityMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\IdentityMap');
     $this->mockQueryFactory = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QueryFactory');
     $this->mockQuery = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface');
     $this->mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
     $this->mockQuery->expects($this->any())->method('getQuerySettings')->will($this->returnValue($this->mockQuerySettings));
     $this->mockQueryFactory->expects($this->any())->method('create')->will($this->returnValue($this->mockQuery));
     $this->mockBackend = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\BackendInterface');
     $this->mockSession = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Session');
     $this->mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
     $this->mockPersistenceManager->expects($this->any())->method('createQueryForType')->will($this->returnValue($this->mockQuery));
     $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
     $this->repository = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Repository', array('dummy'), array($this->mockObjectManager));
     $this->repository->_set('persistenceManager', $this->mockPersistenceManager);
 }
 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Property\Exception\DuplicateObjectException
  */
 public function convertFromShouldThrowExceptionIfMoreThanOneObjectWasFound()
 {
     $this->setupMockQuery(2, $this->never());
     $source = array('__identity' => 666);
     $this->mockPersistenceManager->expects($this->any())->method('getObjectByIdentifier')->with(666)->will($this->throwException(new \TYPO3\CMS\Extbase\Property\Exception\DuplicateObjectException()));
     $this->converter->convertFrom($source, 'SomeType');
 }
Esempio n. 8
0
 /**
  * action delete
  *
  * @param int $uid uid
  * @param string $hash hash
  * @param bool $ajax is ajax request?
  * @param string $settings settings
  * @return void
  */
 public function deleteAction($uid = 0, $hash = "", $ajax = FALSE, $settings = NULL)
 {
     if ($uid > 0) {
         $item = $this->commentRepository->findByUid($uid);
         if (is_object($item)) {
             if ($hash == $item->getHash()) {
                 $redirectUri = $item->getUrlForeign() . "#commentform";
                 // remove item from database
                 $this->commentRepository->remove($item);
                 $this->persistenceManager->persistAll();
                 // add message
                 $messages[] = ["icon" => '<span class="glyphicon glyphicon-ok icon-alert" aria-hidden="true"></span>', "title" => LocalizationUtility::translate(self::LLPATH . 'pi1.action_delete', $this->extensionName), "text" => LocalizationUtility::translate(self::LLPATH . 'pi1.action_delete.success', $this->extensionName), "type" => FlashMessage::OK];
                 // set flash messages
                 $this->helperService->setFlashMessages($this, $messages);
                 // end request
                 if (!$ajax) {
                     // redirect to target url
                     $this->redirectToUri($redirectUri);
                 }
             }
         } else {
             $this->view = NULL;
         }
     } else {
         $this->view = NULL;
     }
 }
Esempio n. 9
0
 /**
  * Executes the query against the database and returns the result
  *
  * @param $returnRawQueryResult boolean avoids the object mapping by the persistence
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result object or an array if $returnRawQueryResult is TRUE
  * @api
  */
 public function execute($returnRawQueryResult = FALSE)
 {
     if ($returnRawQueryResult === TRUE || $this->getQuerySettings()->getReturnRawQueryResult() === TRUE) {
         return $this->persistenceManager->getObjectDataByQuery($this);
     } else {
         return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface', $this);
     }
 }
Esempio n. 10
0
 /**
  * Returns the number of objects in the result
  *
  * @return integer The number of matching objects
  * @api
  */
 public function count()
 {
     if (is_array($this->queryResult)) {
         return count($this->queryResult);
     } else {
         return $this->persistenceManager->getObjectCountByQuery($this->query);
     }
 }
Esempio n. 11
0
 /**
  * Executes the query against the database and returns the result
  *
  * @param bool $returnRawQueryResult avoids the object mapping by the persistence
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result object or an array if $returnRawQueryResult is TRUE
  * @api
  */
 public function execute($returnRawQueryResult = false)
 {
     if ($returnRawQueryResult) {
         return $this->persistenceManager->getObjectDataByQuery($this);
     } else {
         return $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface::class, $this);
     }
 }
 /**
  * @return string
  */
 public function render()
 {
     if (TRUE === $this->isObjectAccessorMode()) {
         $formObjectName = $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName');
         if (FALSE === empty($formObjectName)) {
             $propertySegments = explode('.', $this->arguments['property']);
             $propertyPath = '';
             foreach ($propertySegments as $segment) {
                 $propertyPath .= '[' . $segment . ']';
             }
             $name = $formObjectName . $propertyPath;
         } else {
             $name = $this->arguments['property'];
         }
     } else {
         $name = $this->arguments['name'];
     }
     if (TRUE === $this->hasArgument('value') && TRUE === is_object($this->arguments['value'])) {
         if (NULL !== $this->persistenceManager->getIdentifierByObject($this->arguments['value'])) {
             $name .= '[__identity]';
         }
     }
     if (NULL === $name || '' === $name) {
         return '';
     }
     if (FALSE === $this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix')) {
         return $name;
     }
     $fieldNamePrefix = (string) $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'fieldNamePrefix');
     if ('' === $fieldNamePrefix) {
         return $name;
     }
     $fieldNameSegments = explode('[', $name, 2);
     $name = $fieldNamePrefix . '[' . $fieldNameSegments[0] . ']';
     if (1 < count($fieldNameSegments)) {
         $name .= '[' . $fieldNameSegments[1];
     }
     if (TRUE === $this->viewHelperVariableContainer->exists('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formFieldNames')) {
         $formFieldNames = $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formFieldNames');
     } else {
         $formFieldNames = array();
     }
     $formFieldNames[] = $name;
     $this->viewHelperVariableContainer->addOrUpdate('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formFieldNames', $formFieldNames);
     return $name;
 }
Esempio n. 13
0
 /**
  * @param $flag
  * @param $enabled
  * @throws Tx_FeatureFlag_Service_Exception_FeatureNotFound
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  */
 public function updateFeatureFlag($flag, $enabled)
 {
     $flagModel = $this->getFeatureFlag($flag);
     $flagModel->setEnabled($enabled);
     $this->featureFlagRepository->update($flagModel);
     $this->persistenceManager->persistAll();
     $this->cachedFlags[$flag] = $flagModel;
 }
Esempio n. 14
0
 /**
  * @test
  */
 public function initializeExecutesQueryWithArrayFetchMode()
 {
     /** @var \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
     $queryResult = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::class, array('dummy'), array($this->mockQuery));
     $queryResult->_set('persistenceManager', $this->mockPersistenceManager);
     $queryResult->_set('dataMapper', $this->mockDataMapper);
     $this->mockPersistenceManager->expects($this->once())->method('getObjectDataByQuery')->with($this->mockQuery)->will($this->returnValue(array('FAKERESULT')));
     $queryResult->_call('initialize');
 }
Esempio n. 15
0
 /**
  * @param string                               $filepath
  * @param \HDNET\Importr\Domain\Model\Strategy $strategy
  * @param array                                $configuration
  */
 public function addToQueue($filepath, Strategy $strategy, array $configuration = [])
 {
     $import = $this->objectManager->get(Import::class);
     $start = 'now';
     if (isset($configuration['start'])) {
         $start = $configuration['start'];
     }
     try {
         $startTime = new \DateTime($start);
     } catch (\Exception $e) {
         $startTime = new \DateTime();
     }
     $import->setStarttime($startTime);
     $import->setFilepath($filepath);
     $import->setStrategy($strategy);
     $this->importRepository->add($import);
     $this->persistenceManager->persistAll();
 }
Esempio n. 16
0
 /**
  * Returns the number of objects in the result
  *
  * @return int The number of matching objects
  * @api
  */
 public function count()
 {
     if ($this->numberOfResults === null) {
         if (is_array($this->queryResult)) {
             $this->numberOfResults = count($this->queryResult);
         } else {
             $this->numberOfResults = $this->persistenceManager->getObjectCountByQuery($this->query);
         }
     }
     return $this->numberOfResults;
 }
Esempio n. 17
0
 /**
  * Returns the object with the (internal) identifier, if it is known to the
  * backend. Otherwise NULL is returned.
  *
  * @param string $identifier
  * @param string $className
  * @return object|NULL The object for the identifier if it is known, or NULL
  */
 public function getObjectByIdentifier($identifier, $className)
 {
     if ($this->session->hasIdentifier($identifier, $className)) {
         return $this->session->getObjectByIdentifier($identifier, $className);
     } else {
         $query = $this->persistenceManager->createQueryForType($className);
         $query->getQuerySettings()->setRespectStoragePage(false);
         $query->getQuerySettings()->setRespectSysLanguage(false);
         return $query->matching($query->equals('uid', $identifier))->execute()->getFirst();
     }
 }
Esempio n. 18
0
 protected function setUp()
 {
     $this->mockQueryFactory = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory::class);
     $this->mockQuery = $this->getMock(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class);
     $this->mockQuerySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
     $this->mockQuery->expects($this->any())->method('getQuerySettings')->will($this->returnValue($this->mockQuerySettings));
     $this->mockQueryFactory->expects($this->any())->method('create')->will($this->returnValue($this->mockQuery));
     $this->mockSession = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Session::class);
     $this->mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
     $this->mockBackend = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Backend::class, array('dummy'), array($this->mockConfigurationManager));
     $this->inject($this->mockBackend, 'session', $this->mockSession);
     $this->mockPersistenceManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class, array('createQueryForType'));
     $this->inject($this->mockBackend, 'persistenceManager', $this->mockPersistenceManager);
     $this->inject($this->mockPersistenceManager, 'persistenceSession', $this->mockSession);
     $this->inject($this->mockPersistenceManager, 'backend', $this->mockBackend);
     $this->mockPersistenceManager->expects($this->any())->method('createQueryForType')->will($this->returnValue($this->mockQuery));
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
     $this->repository = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Repository::class, array('dummy'), array($this->mockObjectManager));
     $this->repository->_set('persistenceManager', $this->mockPersistenceManager);
 }
Esempio n. 19
0
 /**
  * Returns a query for objects of this repository
  *
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  * @api
  */
 public function createQuery()
 {
     $query = $this->persistenceManager->createQueryForType($this->objectType);
     if ($this->defaultOrderings !== array()) {
         $query->setOrderings($this->defaultOrderings);
     }
     if ($this->defaultQuerySettings !== NULL) {
         $query->setQuerySettings(clone $this->defaultQuerySettings);
     }
     return $query;
 }
Esempio n. 20
0
 /**
  * Fetch an object from persistence layer.
  *
  * @param mixed $identity
  * @param string $targetType
  * @throws \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException
  * @throws \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException
  * @return object
  */
 protected function fetchObjectFromPersistence($identity, $targetType)
 {
     if (ctype_digit((string) $identity)) {
         $object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
     } else {
         throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException('The identity property "' . $identity . '" is no UID.', 1297931020);
     }
     if ($object === null) {
         throw new \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException(sprintf('Object of type %s with identity "%s" not found.', $targetType, print_r($identity, true)), 1297933823);
     }
     return $object;
 }
Esempio n. 21
0
 /**
  * Generates new temporary user
  *
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  *
  * @return \Abra\Cadabra\Domain\Model\FrontendUser
  */
 protected function createTemporaryUser()
 {
     $username = $this->createUniqueUserName();
     $user = new \Abra\Cadabra\Domain\Model\FrontendUser();
     $user->setUsername($username);
     $user->setPassword(sha1(time()));
     $userGroupId = $this->settings['frontendUser']['temporaryFrontendUserGroupId'];
     /** @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $userGroup */
     $userGroup = $this->frontendUserGroupRepository->findByIdentifier($userGroupId);
     $user->addUsergroup($userGroup);
     $user->setTemporaryUser(true);
     $this->frontendUserRepository->add($user);
     $this->persistenceManager->persistAll();
     return $user;
 }
Esempio n. 22
0
 /**
  * @param \Abra\Cadabra\Domain\Model\Article $article
  * @param integer $amount
  *
  * @return void
  */
 public function addArticleAction($article, $amount = 1)
 {
     $positions = $this->basket->getPositions();
     /** @var \Abra\Cadabra\Domain\Model\Ordering\BasketEntry $position */
     foreach ($positions as $position) {
         if ($position->getUid() === $article->getUid()) {
         }
     }
     $basketEntry = new \Abra\Cadabra\Domain\Model\Ordering\BasketEntry();
     $basketEntry->setArticle($article);
     $basketEntry->setAmount($amount);
     $basketEntry->setBasket($this->basket);
     $this->basket->addPosition($basketEntry);
     $this->basketRepository->update($this->basket);
     $this->persistenceManager->persistAll();
     $pageId = $this->settings['basket']['basketPageId'] ? $this->settings['basket']['basketPageId'] : null;
     $this->redirect('show', 'Basket', 'cadabra', null, $pageId);
 }
Esempio n. 23
0
 /**
  * Deletes a topic and all posts contained in it.
  *
  * @param Topic $topic
  */
 public function deleteTopic(Topic $topic)
 {
     foreach ($topic->getPosts() as $post) {
         /** @var $post Post */
         $post->getAuthor()->decreasePostCount();
         $post->getAuthor()->decreasePoints((int) $this->settings['rankScore']['newPost']);
         $this->frontendUserRepository->update($post->getAuthor());
     }
     $forum = $topic->getForum();
     $forum->removeTopic($topic);
     $this->topicRepository->remove($topic);
     $this->persistenceManager->persistAll();
     $user = $this->getCurrentUser();
     if (!$user->isAnonymous()) {
         $user->decreaseTopicCount();
         if ($topic->getQuestion() == 1) {
             $user->decreaseQuestionCount();
         }
         $this->frontendUserRepository->update($user);
     }
 }
Esempio n. 24
0
 /**
  * Traverses the given object structure in order to transform it into an
  * array structure.
  *
  * @param object $object Object to traverse
  * @param array $configuration Configuration for transforming the given object or NULL
  * @return array Object structure as an array
  */
 protected function transformObject($object, array $configuration)
 {
     if ($object instanceof \DateTime) {
         return $object->format(\DateTime::ISO8601);
     } else {
         $propertyNames = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettablePropertyNames($object);
         $propertiesToRender = array();
         foreach ($propertyNames as $propertyName) {
             if (isset($configuration['_only']) && is_array($configuration['_only']) && !in_array($propertyName, $configuration['_only'])) {
                 continue;
             }
             if (isset($configuration['_exclude']) && is_array($configuration['_exclude']) && in_array($propertyName, $configuration['_exclude'])) {
                 continue;
             }
             $propertyValue = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($object, $propertyName);
             if (!is_array($propertyValue) && !is_object($propertyValue)) {
                 $propertiesToRender[$propertyName] = $propertyValue;
             } elseif (isset($configuration['_descend']) && array_key_exists($propertyName, $configuration['_descend'])) {
                 $propertiesToRender[$propertyName] = $this->transformValue($propertyValue, $configuration['_descend'][$propertyName]);
             }
         }
         if (isset($configuration['_exposeObjectIdentifier']) && $configuration['_exposeObjectIdentifier'] === TRUE) {
             if (isset($configuration['_exposedObjectIdentifierKey']) && strlen($configuration['_exposedObjectIdentifierKey']) > 0) {
                 $identityKey = $configuration['_exposedObjectIdentifierKey'];
             } else {
                 $identityKey = '__identity';
             }
             $propertiesToRender[$identityKey] = $this->persistenceManager->getIdentifierByObject($object);
         }
         if (isset($configuration['_exposeClassName']) && ($configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED || $configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_UNQUALIFIED)) {
             $className = get_class($object);
             $classNameParts = explode('\\', $className);
             $propertiesToRender['__class'] = $configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED ? $className : array_pop($classNameParts);
         }
         return $propertiesToRender;
     }
 }
Esempio n. 25
0
 /**
  * @param CoreFileReference $falFileReference
  * @param int $resourcePointer
  * @return ExtbaseFileReference
  */
 protected function createFileReferenceFromFalFileReferenceObject(CoreFileReference $falFileReference, int $resourcePointer = null) : ExtbaseFileReference
 {
     if ($resourcePointer === null) {
         $fileReference = $this->objectManager->get(ExtbaseFileReference::class);
     } else {
         $fileReference = $this->persistenceManager->getObjectByIdentifier($resourcePointer, ExtbaseFileReference::class, false);
     }
     $fileReference->setOriginalResource($falFileReference);
     return $fileReference;
 }