[Flow] Validating dates amongst different objects
Stephen Bungert
stephenbungert at yahoo.de
Wed Aug 14 10:28:35 CEST 2013
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