/**
  * Marks an object as updated
  * 
  * @param \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object
  */
 public function markObjectUpdated(\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object)
 {
     if ($object->getUid()) {
         $this->updatedObjects[get_class($object)][] = $object->getUid();
     }
 }
 /**
  * Converts a given object recursively into an array.
  *
  * @param \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object
  * @return array
  * @todo Refactore this into convertDomainObjectsToIdentityArrays()
  */
 public function convertTransientObjectToArray(\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object)
 {
     $result = array();
     foreach ($object->_getProperties() as $propertyName => $propertyValue) {
         if ($propertyValue instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) {
             if ($propertyValue->getUid() !== null) {
                 $result[$propertyName] = $propertyValue->getUid();
             } else {
                 $result[$propertyName] = $this->convertTransientObjectToArray($propertyValue);
             }
         } elseif (is_array($propertyValue)) {
             $result[$propertyName] = $this->convertDomainObjectsToIdentityArrays($propertyValue);
         } else {
             $result[$propertyName] = $propertyValue;
         }
     }
     return $result;
 }
Beispiel #3
0
 /**
  * @param \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $abstractDomainObject
  * @param string                                               $message
  * @param int                                                  $severity
  * @param string                                               $translateArticle
  * @param boolean                                              $addFlashMessage
  */
 public function deleteRecord(\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $abstractDomainObject, $message = '', $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR, $translateArticle = ActionController::NEUTER_ARTICLE, $addFlashMessage = false)
 {
     $reflect = new \ReflectionClass($abstractDomainObject);
     $repository = lcfirst($reflect->getShortName()) . 'Repository';
     if ($addFlashMessage) {
         $this->addFlashMessage($message ?: LocalizationUtility::translate($translateArticle . '.record_deleted', 'ecom_toolbox', [$reflect->getShortName(), $abstractDomainObject->_hasProperty('title') ? $abstractDomainObject->_getProperty('title') : $abstractDomainObject->__toString()]), '', $severity);
     }
     $this->{$repository}->remove($abstractDomainObject);
 }