[Cubicweb] nested relation / hook validation

Carlos Balderas carlos.balderas at gmail.com
Tue Jan 25 07:29:53 CET 2011


Hi List!

I am trying to make a hook validation but I can figure out how this can be
done.

Here the explanation of the schema

* *ProcessRole* is a composite entity of *Process*.
* *ProcessRole* has a relation to *JobTitle* relation.

I want to validate that a *ProcessRole* shouldn't be added to a *Process*,
if the *JobTitle* already exists in other *ProcessRole* in the same *Process
*.

e.g.
Process = Certification One
which has a :
                 ProcessRole = Validator
                JobTitle = Human R. 1
Then, I don't want any other ProcessRole to be added with the JobTitle =
Human R.1 to Certification One Process.

I tried to make this validation in the event "before/after" add relation at
the moment to add JobTitle to ProcessRole and what I found at this moment I
could not rich the Process (empty relation) entity which ProcessRole will be
added.

I also tried to make the validation in the event "before/after" add relation
at the moment to add ProcessRole to Process, but at this moment I could not
rich the JobTitle (empty relation) entity to validate if this JobTitle
exists already related to the Process.

I hope I explained myself well.

Any comment or help will be very appreciated.

Thank you
Carlos BALDERAS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20110125/755cc23f/attachment-0185.html>


More information about the Cubicweb mailing list