[Flow] Validating dates amongst different objects

Stephen Bungert stephenbungert at yahoo.de
Wed Aug 14 12:53:11 CEST 2013


Maybe then check in your create/update actions before add/update is called 
and if there are problems you maybe redirect them to the edit form and add a 
flash message. If everything is ok call your repos update method/add

Stephen.

"Mark Kuiphuis" <typo3 at markyourweb.com> schrieb im Newsbeitrag 
news:mailman.1.1376476653.21607.flow at lists.typo3.org...
> Thanks for your reply,
>
> I have read that page a couple of times now, but I fail to see how 
> something like this could be implemented.
>
> I don't think I need to validate a complete model. Whenever I want to 
> create a new object with a start and end date I need to validate if the 
> start and/or end date is within a certain range or after a certain date 
> from another object....
>
> I'll do some more research tomorrow, but if someone else already has 
> achieved something similar, than I would like to hear/read about it :D
>
> Cheers, Mark K.
>
>
> On 14/08/13 6:28 PM, Stephen Bungert wrote:
>> You can create validators for whole models:
>>
>> http://docs.typo3.org/flow/TYPO3FlowDocumentation/stable/TheDefinitiveGuide/PartIII/Validation.html
>> (search for "Validating Domain Models")
>>
>> I haven't tried this yet, but in the validator you have access to the 
>> model
>> and I guess any of its properties (like your employees company object)
>>
>> Maybe you could then check what you need as you would have access to all
>> dates.
>>
>> Stephen.
>>
>> "Mark Kuiphuis" <typo3 at markyourweb.com> schrieb im Newsbeitrag
>> news:mailman.1.1376462502.13037.flow at lists.typo3.org...
>>> Hi all,
>>>
>>> I am aware of the "DateTimeRangeValidator" which allows you to validate 
>>> a
>>> DateTime object whether that date is for example in between the
>>> "latestDate" and the "earliestDate".
>>>
>>> But is there a way to pass an extra one (or sometimes even 2 objects) 
>>> and
>>> use two properties of this object (startdate and enddate) to validate 
>>> the
>>> new date?
>>>
>>> For example:
>>>
>>> An employee starts working for one company. I create a new object called
>>> employment which holds the company object, the employee object  as well 
>>> as
>>> the start date (and/or) end date (the end date can be NULL if the 
>>> employee
>>> is still working for this company).
>>>
>>> This employee can become a project leader for a certain project and I
>>> need to record the start date (and potentially also the end date, but 
>>> not
>>> necessarily) and I would like to check that the start date of when 
>>> he/she
>>> becomes the project leader is after the start date of the employment.
>>>
>>> All date information is available in the create or update actions of the
>>> "ProjectLeader" controller, but then I am already too late (am I not?) 
>>> to
>>> go back to the new or edit form when the selected date is for example
>>> before the start date of his/her employment.
>>>
>>> (I even should check that, when creating the employment record, but also
>>> the project leader record, that the start date of both records are later
>>> than the date of birth of this employee :-)
>>>
>>> Sorry for the long piece of text. I seem to struggle with keeping
>>> questions short :-)
>>>
>>> Kind regards,
>>>
>>> Mark Kuiphuis
>>
>>
> 




More information about the Flow mailing list