Task #68157

Extended TypeConverter PersistentObjectConverter to overload QuerySettings

Added by Manuel Selbach about 4 years ago. Updated 7 months ago.

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

0%

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

patch_overload_querySettings_by_initializeAction.diff View (6.16 KB) Manuel Selbach, 2015-07-15 13:03

patch_overload_querySettings_by_initializeAction_v2.diff View (5.96 KB) Manuel Selbach, 2015-07-15 13:51

patchtest_1.0.0_201507161032.zip (10.7 KB) Manuel Selbach, 2015-07-16 10:33

patchtest_demo_data.t3d (2.07 KB) Manuel Selbach, 2015-07-16 10:33

History

#1 Updated by Manuel Selbach about 4 years ago

Sorry there is a typo at this line in the example code

- $modelConfiguration = $this->arguments->getArgument('object')->getPropertyMappingConfiguration();
+ $modelConfiguration = $this->arguments->getArgument('model')->getPropertyMappingConfiguration();

and at:

- * @param \MyVendor\MyExtension\Domain\Model\Model $user
+ * @param \MyVendor\MyExtension\Domain\Model\Model $model

Hope the example helps to understand how it could work.

Thanks to all

#2 Updated by Anja Leichsenring about 4 years ago

  • Subject changed from Extended TypoConverter PersistentObjectConverter to overload QuerySettings to Extended TypeConverter PersistentObjectConverter to overload QuerySettings

#4 Updated by Manuel Selbach about 4 years ago

To simplify the testing of the patch I provide an example extension here with some demo data.

Hope everything works.

Install the extension.
Include the static template and set a storage to the "FeUsers" sysFolder in the "Constant Editor" for the extension.

Test instruction:
- Disable the FeUser in the sysFolder
- Go to the page "patchtest"
- the form will be filled out to fasten up the testing process ;)
- proceed all steps
-> result should be an active FeUser with an email set, if you provide some in step two ;)

#5 Updated by Gerrit Code Review about 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/41441

#6 Updated by Frank Naegler over 3 years ago

  • Status changed from Under Review to New

#7 Updated by Riccardo De Contardi 12 months ago

  • Category set to Extbase

#8 Updated by Susanne Moog 7 months ago

  • Status changed from New to Needs Feedback
  • Assignee set to Manuel Selbach

@Manuel can you come up with a review / fix for this issue and is it still relevant?

#9 Updated by Helmut Hummel 7 months ago

  • Status changed from Needs Feedback to Accepted

@Susi: This is still relevant and there is a patch set already on Gerrit, which I'd consider good enough to build upon. It is abandoned, but should imho be restored.

#10 Updated by Susanne Moog 7 months ago

@Helmut Thanks for the feedback :)

Also available in: Atom PDF