示例#1
0
 /**
  * Determine the storage page ID for a given NEW record
  *
  * This does the following:
  * - If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records.
  * - If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records.
  *
  * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object
  * @return int the storage Page ID where the object should be stored
  */
 protected function determineStoragePageIdForNewRecord(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object = null)
 {
     $pids = null;
     /**
      * What happens here?
      *
      * We globally overwrite implementation of backend class (this class).
      * This means that all other Extbase plugins that are probably inserted on the
      * same page would also use this backend class.
      *
      * So we give the yag domain models an interface which we check here and use
      * pid detection only, if we get a new objecte that implements this interface.
      * All other objects will be handled the default way.
      */
     if (is_a($object, 'Tx_Yag_Domain_Model_DomainModelInterface')) {
         $pids = $this->pidDetector->getPids();
     }
     if (!empty($pids) && count($pids) > 0) {
         return $pids[0] == -1 ? 0 : $pids[0];
     } else {
         return parent::determineStoragePageIdForNewRecord($object);
     }
 }
示例#2
0
 /**
  * Commits the current persistence session.
  *
  * @return void
  */
 public function commit()
 {
     $this->_addedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_removedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_changedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     parent::commit();
     foreach ($this->_addedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterInsertCommitObjectHijax', array('object' => $object));
     }
     foreach ($this->_removedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterRemoveCommitObjectHijax', array('object' => $object));
     }
     foreach ($this->_changedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterUpdateCommitObjectHijax', array('object' => $object));
     }
     $this->_addedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_removedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_changedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
 }