Bug #55861

New PropertyMapper must accept not found arguments

Added by Georg Ringer about 6 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2014-02-11
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

A typical controller call looks like this

    /**
     * Single view of a news record
     *
     * @param Tx_News_Domain_Model_News $news news item
     * @param integer $currentPage current page for optional pagination
     * @return void
     */
    public function detailAction(Tx_News_Domain_Model_News $news = NULL, $currentPage = 1) {
}

As long as no news property or a correct uid is given everything is ok but if the record can't be found, the exception

Exception while property mapping at property path "":Object with identity "3" not found.
is thrown.

There is currently no way for an extension, to handle this error in the own code! It is very normal, that records get deleted, set to hidden or what so ever. Therefore it must be up to the extension if a default value is set (like NULL) to return NULL by the property mapper!

This behaviour has been introduced with the new property mapper, disabling it makes it work fine again (which is of course no choice at all)


Related issues

Related to TYPO3.Flow - Feature #55869: Allow custom handling of propertyMapping errors Closed 2014-02-11
Related to TYPO3 Core - Bug #70610: PropertyMapper directly throws TargetNotFoundException Closed 2015-10-12

Associated revisions

Revision ba31c035 (diff)
Added by Anja Leichsenring over 4 years ago

[BUGFIX] Extbase: Optional arguments must not throw an Exception

Example:
public function barAction(\Vendor\Ext\Domain\Model\Foo $foo = NULL)

If the property mapper receives NULL, 0 or a valid value
the property mapping does not fail. But if the value is
a valid uid (>0) and there is no record with that uid
the whole property mapping fails.

While this is totally valid for required arguments,
optional arguments must be skipped.

Resolves: #55861
Resolves: #55837
Resolves: #62951
Releases: master, 6.2
Change-Id: I4c954bac50be1d34ea09bfc21f8978e9165683d1
Reviewed-on: http://review.typo3.org/39946
Reviewed-by: Alexander Schnitzler <>
Tested-by: Alexander Schnitzler <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

Revision 67535f37 (diff)
Added by Anja Leichsenring over 4 years ago

[BUGFIX] Extbase: Optional arguments must not throw an Exception

Example:
public function barAction(\Vendor\Ext\Domain\Model\Foo $foo = NULL)

If the property mapper receives NULL, 0 or a valid value
the property mapping does not fail. But if the value is
a valid uid (>0) and there is no record with that uid
the whole property mapping fails.

While this is totally valid for required arguments,
optional arguments must be skipped.

Resolves: #55861
Resolves: #55837
Resolves: #62951
Releases: master, 6.2
Change-Id: I4c954bac50be1d34ea09bfc21f8978e9165683d1
Reviewed-on: http://review.typo3.org/42663
Reviewed-by: Alexander Schnitzler <>
Tested-by: Alexander Schnitzler <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

History

#1 Updated by Gerrit Code Review about 6 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 https://review.typo3.org/27535

#2 Updated by Gerrit Code Review about 6 years ago

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

#3 Updated by Andreas Kiessling almost 6 years ago

Any news on this one? IMHO a breaking change with the new property mapper!
The fix from Bastian only made it to Flow so far, but we really need this one too :/

#4 Updated by Georg Ringer almost 6 years ago

the change is not yet merged in flow.

#5 Updated by Andreas Kiessling almost 6 years ago

Ah, yes... You're right!
I'd still prefer your patch, as it does not seem to need any new code to handle the issue.

#6 Updated by Florian Schwaiger over 5 years ago

Is this fixed yet or do I have to merge the patch in my project manually?

#7 Updated by Marc Hirdes over 5 years ago

I agree to Florain: Is this fixed yet or do I have to merge the patch in my project manually?

#8 Updated by Marc Hirdes over 5 years ago

?

#9 Updated by Henrik Ziegenhain over 5 years ago

Hi all,

nope, this Issue is not merged or fixed by another one.

The patch from above is working for my specific problem.

#10 Updated by Sven Burkert almost 5 years ago

Please fix this soon, this bug is really annoying and it applies to very much extensions.

#11 Updated by Johann Carstens over 4 years ago

Would be nice if this could be fixed in the next 6.2.xx Version. I just ran into the same problem.

#12 Updated by Klaus Bitto over 4 years ago

This is a high priority issue also for us.

Is there any official status on the matter?

#13 Updated by Fabian Schöner over 4 years ago

Im also running in this issue almost daily.

Any official status update or better a quick fix would be highly appreciated!

#14 Updated by Marc Bastian Heinrichs over 4 years ago

  • Target version changed from 6.2.0 to next-patchlevel

The first patch set is abandoned now.

Please test the new WIP Patch https://review.typo3.org/#/c/39946

#15 Updated by Gerrit Code Review over 4 years ago

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

#16 Updated by Gerrit Code Review over 4 years ago

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

#17 Updated by Anja Leichsenring over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#18 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF