Bug #54057
closedRecursive validation validates too deep
0%
Description
Hello Extbase-Team,
I have 2 Domainmodels: Event and Day. It's a MM-Relation. One Event can be at several days and one day there can be several events. Thats why I have defined event.days as LazyObjectStorage and day.events as LazyObjectStorage.
I have debugged the Validator-API and found out that the loop over event.days needs nearly a second.
It validates my event -> days -> all related events incl. my event -> days -> all related events incl. my event -> days -> and so on. Somewhere after many hundreds of loops the validator breaks and returns a valid Result-Object, but all previous validated properties (before days, like: title, eventStart, ...) get lost.
So maybe it would be good to have a cache for already validated objects. They all have a unique identifier spl_hash. So in my opinion it should be possible to implement such a cache.
What do you think about it?
Stefan
Updated by Markus Klein almost 11 years ago
Hm sounds more like an endless loop.
So a cache is more a "side effect", it is more a loop detection mechanism.
Is there any prevention from validation loops at all?
Thinking about A.theB = B; B.theA = A;
Updated by Stefan Froemken almost 11 years ago
Hello Markus,
I just found it. There is already a cache inside. The cache is only valid for the current CollectionValidator and not for the whole Domainmodel. Here an example:
Day1:
- Event1
- Event2
- Event3
Day2:
- Event1
- Event3
- Event5
Day3:
- Event1
- Event2
- Event4
So, for each day a new Cache will be created. That means, that Event1 will be validated 3 times. Maybe this works good for 1:1 and 1:N, but not for N:M:
Event1:Day1: Event1
-
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
-----Day1-3 again
---- Event3
---- Event5
---Day3:
---- Event1
-----Day1-3 again
---- Event2
---- Event4
-- Event2
-- Event3Day2: Event1
-
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
-----Day1-3 again
---- Event3
---- Event5
---Day3:
---- Event1
---- Event2
---- Event4
-- Event3
-- Event5Day3: Event1
-
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
---- Event3
---- Event5
---Day3:
---- Event1
---- Event2
---- Event4
-- Event2
-- Event4
Issue #53816 helped me a little bit. Defining event.days as ObjectStorage and day.events as LazyObjectStorage stops recursive endless validation.
What do you think to implement a "stopRecursion"-Annotation for Domainmodel-Properties?
Stefan
Updated by Alexander Schnitzler almost 11 years ago
Hi Stefan.
We are aware of these problems as Nico de Haen already spent a lot of time with this issue.
I talked to Anja to have another code sprint just for fixing these validation issues in january.
Most probably we will just join the sprint that takes place with all active contributors. Personally I really struggle with analysing the validation api beside my daily work, so I like the idea of letting this issue rest until we find a weekend to handle this issue together.
Updated by Alexander Opitz about 10 years ago
- Project changed from 534 to TYPO3 Core
- Category changed from Extbase: Validation to Extbase
- Target version changed from 6.2.0 to 7.0
- TYPO3 Version set to 6.2
- Is Regression set to No
Updated by Tymoteusz Motylewski almost 10 years ago
sounds like related to https://jira.typo3.org/browse/FLOW-17 Persistence: object tree validation performance is really slow
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 7.0 to 7.1 (Cleanup)
Updated by Benni Mack over 9 years ago
- Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Stefan Froemken over 1 year ago
- Status changed from New to Closed
Hello,
I remember that issue, but I have changed day->events (LazyObjectStorage) to day->event (Event model) now, which solves this issue. Further LazyObjectStorages prevents recursive validation in newer TYPO3 systems.
Further I prefer to work with:
public function show(int $event) { $event = $this->eventRepository->findByIdentifier($event); }
That also prevents recursive validation while visiting the detail view.
Closing this issue for now.