[TYPO3-mvc] 6.2: How to debug recursive validation
g4-lisz at tonarchiv.ch
g4-lisz at tonarchiv.ch
Fri Jun 6 16:04:22 CEST 2014
Hi all
I had to reanimate this thread...
I had an issue with the validation validation because of some object
getter methods, which use findBy() through repositories.
E.g.
/**
* Returns the messung
*
* @return
Tx_Extbase_Persistence_ObjectStorage<Tx_Hplusinfo_Domain_Model_Messung>
*/
public function getMessung() {
$repository = new
Tx_Hplusinfo_Domain_Repository_MessungRepository();
return $repository->findByKlinik($this);
}
This worked in 4.6.
But now, findByXxx() returns the wrong type: "The given subject was not
a collection."
How can I solve this? I know that it's not nice to have this kind of
getter. But at the moment there is no other way to have the children
sorted in fluid, if only the parent object is passed to the template.
Like: <f:for each="{klinik.messung}" as="messung"> ... </f:for>
BR
Till
On 05/19/2014 08:08 PM, g4-lisz at tonarchiv.ch wrote:
> Hi Helmut,
>
> thank you so much!
>
> That was the hint I was looking for.
>
> Now I get a message which really tells me what is going wrong - with
> this information I should be able to fix it.
>
> The message says: Error for klinik.apparativausstattung: The given
> subject was not a collection.
>
> Best regards,
> Till
>
> On 05/19/2014 06:16 PM, Helmut Hummel wrote:
>> Hi Till!
>>
>> On 17.05.14 15:52, g4-lisz at tonarchiv.ch wrote:
>>
>>> Is there a way to make the errors a little bit more
>>> communicative?
>> The error message you see is compiled in the errorAction in the
>> ActionController class in Extbase.
>>
>> You can override this method in your controller (be careful to copy
>> and paste everything necessary for the rewritten property mapper you
>> see in this method).
>>
>> In this method you have access to the error messages from validation:
>>
>> By calling $this->arguments->getValidationResults()
>>
>> You could e.g. iterate over the flattened errors and add them to the
>> message, but be careful and only do this during debugging, as we
>> removed verbosity there because of a security issue[1]
>>
>>
>> foreach
>> ($this->arguments->getValidationResults()->getFlattenedErrors() as
>> $propertyPath => $errors) {
>> foreach ($errors as $error) {
>> $message .= 'Error for ' . $propertyPath . ': ' .
>> $error->render() . PHP_EOL;
>> }
>> }
>>
>>
>> I would be interested in your findings.
>>
>>
>> Kind regards,
>> Helmut
>>
>> [1]https://review.typo3.org/26217
>>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list