comanage-dev - Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co
Subject: COmanage Developers List
List archive
- From: Benn Oshrin <>
- To: Scott Koranda <>
- Cc: comanage-dev <>
- Subject: Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co
- Date: Thu, 16 Feb 2012 22:11:00 -0500
On 2/16/12 4:23 PM, Scott Koranda wrote:
So it is co_person_id in cm_co_org_identity_links that is not
being set and I believe the error is accurate--you do want
that to be set.
Cake should automagically populate the cross reference by populating co_person_id after co_person is saved.
I think the problem is that the line
$model->saveAll($data)
in the add() method of the StandardController is really a
saveAssociate() call and for that call the default is to
validate *all* records before any are saved. See
http://book.cakephp.org/2.0/en/models/saving-your-data.html
But since the CoPerson object has not been saved there is no
co_person_id that can go into cm_co_org_identity_links.
If you agree that my analysis is correct, then how do you want
to unwind this?
We're sort of coming at this from two sides of the same coin. Arguably, CoOrgIdentityLink::model shouldn't require co_person_id to be set because at the time the pages are submitted (for HTML pages) there is no value to submit. We could update the controller to modify or drop the validation requirements when not !this->restful.
There is an option to saveAssociated() so that validation
happens table by table (validate = 'true' instead of the
default validate = 'false'), but do we want that to be applied
for every call to add() of the StandardController?
This would be the other way to handle it. It's plausible this is a general solution to this class of problem... always validate per model save rather than all at once up front. That avoids having to effectively have two validate approaches (one for HTML, one for REST).
Previously, this worked because the validation requirements weren't there. (I added them because of changes to the REST validations as part of CO-112.) As such, I'm still inclined to favor the approach where $validate correctly reflects what validations are actually needed.
-Benn-
- [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/16/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/16/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/16/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/18/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/18/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/18/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/17/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Benn Oshrin, 02/16/2012
- Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co, Scott Koranda, 02/16/2012
Archive powered by MHonArc 2.6.16.