[TYPO3-mvc] extbase/fluid: validating and manipulating data before saving?

S.Korth s.korth at dms-arts.com
Wed May 12 12:23:13 CEST 2010


Sven Kalbhenn schrieb:
> Hi guys!
> 
> I'm writing a new extension for "plane-reservations" with extbase and fluid.
> For the reservation, I need a frontend-form with a date- and time-field.
> If I understand everything right, I have to write a new ViewHelper for rendering the form.
> OK, but where is the correct place for the validation and transforming the posted values into a DateTime-Object?
> 
> If I send the date as a string, I always get the error:
> "Tx_Planereservation_Domain_Model_Reservation::setStart() must be an instance of DateTime, string given in .../typo3conf/ext/planereservation/Classes/Domain/Model/Reservation.php"
> 
> I think the setter-method of the model is the wrong place - because the persistent-manager will use this method as well.
> So, is the controller the correct place??? Or is there a mechanism - like the ViewHelpers - to validate and manipulate the data before saving it?
> 
> Please, could someone push me in the right direction?
> 
> CU...Sven Kalbhenn
> 
Hey Sven,

you have a kind of validation within the reflection api (comments on 
model attributes). Flow3 and Extbase uses this.

/**
*
* Some Date
* @var DateTime
* @validate NotEmpty
*
*/
Protected $thedate


Or did you mean something else ?

Sascha



More information about the TYPO3-project-typo3v4mvc mailing list