Project

General

Profile

Actions

Task #68157

closed

Extended TypeConverter PersistentObjectConverter to overload QuerySettings

Added by Manuel Selbach over 9 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Category:
Extbase
Target version:
-
Start date:
2015-07-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Hi @ all,

e.g. if you would like to pass a hidden object to another action, you will run in an exception.

#1297759968: Exception while property mapping at property path "":Missing storage page ids

By default TYPO3 sets the QuerySettings to enable ignore fields, which is absolutely fine.
But in some special cases you would like to overload this behavior for an action in the controller.
Here we can use the initialize action, which is called before every action and set the QuerySettings for a certain object.

Attached you will find my patch to allow this.

Example after supplying the patch for a controller show action:


    public function initializeShowAction()
    {
        $modelConfiguration = $this->arguments->getArgument('object')->getPropertyMappingConfiguration();
        $modelConfiguration->setTypeConverterOptions(
            'TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter',
            array(
                \TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::IGNORE_ENABLE_FIELDS => true,
                \TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::RESPECT_STORAGE_PAGE => false,
                \TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::RESPECT_SYS_LANGUAGE => false,
            )
        );
    }

    /**
     * show action
     *
     * @param \MyVendor\MyExtension\Domain\Model\Model $user
     */
    public function showAction(\MyVendor\MyExtension\Domain\Model\Model $model)
    {
        $this->view->assign('model', $model);
    }

Following options will be available with example data:

IGNORE_ENABLE_FIELDS = true|false
RESPECT_STORAGE_PAGE = true|false
RESPECT_SYS_LANGUAGE = true|false
ENABLE_FIELDS_TO_BE_IGNORED = hidden,starttime
INCLUDE_DELETED = true|false
SYS_LANGUAGE_UID = 2
STORAGE_PAGE_IDS = 1,2

Files

Actions

Also available in: Atom PDF