Bug #29290

Additional Identity Properties not set on mapping error

Added by Torsten over 1 year ago. Updated about 1 month ago.

Status:Under Review Start date:2011-08-26
Priority:Must have Due date:
Assignee:Bastian Waidelich % Done:

0%

Category:ViewHelpers
Target version:-
Has patch:Yes FLOW3 version affected:FLOW3 1.0.0
Votes: 3 (View)

Description

After a mapping error occurred, no additional identity properties are set and FLOW3 tries to create a new object.

Could be easily fixed in TYPO3\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper

currently:

    protected function getValue() {
        $value = NULL;

        if ($this->arguments->hasArgument('value')) {
            $value = $this->arguments['value'];
        } elseif ($this->hasMappingErrorOccured()) {
            $value = $this->getLastSubmittedFormData();
        } elseif ($this->isObjectAccessorMode() && $this->viewHelperVariableContainer->exists('TYPO3\Fluid\ViewHelpers\FormViewHelper', 'formObject')) {
            $this->addAdditionalIdentityPropertiesIfNeeded();
            $value = $this->getPropertyValue();
        }
        if (is_object($value)) {
            $identifier = $this->persistenceManager->getIdentifierByObject($value);
            if ($identifier !== NULL) {
                $value = $identifier;
            }
        }
        return $value;
    }

Better:

    protected function getValue() {
        $value = NULL;

        if ($this->arguments->hasArgument('value')) {
            $value = $this->arguments['value'];
        } elseif ($this->hasMappingErrorOccured()) {
            $this->addAdditionalIdentityPropertiesIfNeeded();
            $value = $this->getLastSubmittedFormData();
        } elseif ($this->isObjectAccessorMode() && $this->viewHelperVariableContainer->exists('TYPO3\Fluid\ViewHelpers\FormViewHelper', 'formObject')) {
            $this->addAdditionalIdentityPropertiesIfNeeded();
            $value = $this->getPropertyValue();
        }
        if (is_object($value)) {
            $identifier = $this->persistenceManager->getIdentifierByObject($value);
            if ($identifier !== NULL) {
                $value = $identifier;
            }
        }
        return $value;
    }


Related issues

duplicated by TYPO3.Fluid - Bug #33274: Viewhelpers extending AbstractFormFieldViewHelper should ... Closed 2012-01-18
duplicated by TYPO3.Fluid - Bug #46038: Subproperty with Radio fields doesn't render hidden ident... Closed 2013-03-05

History

Updated by Karsten Dambekalns over 1 year ago

  • FLOW3 version affected set to FLOW3 1.0.0

Updated by Bastian Waidelich over 1 year ago

  • Status changed from New to Accepted
  • Assignee set to Bastian Waidelich

Updated by Gerrit Code Review 10 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13600

Updated by Gerrit Code Review 10 months ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13600

Updated by Gerrit Code Review 9 months ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13600

Updated by Gerrit Code Review 9 months ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13600

Updated by Gerrit Code Review 6 months ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13600

Updated by Gerrit Code Review about 1 month ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13600

Updated by Gerrit Code Review about 1 month ago

Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13600

Also available in: Atom PDF