Justin
--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at http://groups.google.com/group/cf-orm-dev.
For more options, visit https://groups.google.com/d/optout.
to this:
//ProfilePlan.cfc
component persistent="true" output="false" table="profilesPlans"
{
property name="profileID" fieldtype="id,many-to-one" fkcolumn="profileID" cfc="model.Profile";
property name="planID" fieldtype="id";
property name="otherName" type="string" length="255" sqltype="varchar(255)" ;
}
Thanks
I have updated my components as show bellow.
As a result, I can properly Save/Delete a profile and all the ProfilePlan dependencies are properly saved/ deleted.
The issue I have is when trying to update a profile.
For example if I add a plan then the save properly adds the new plan (to profilesPlans), but if I delete a plan, it doesn't delete it from the profilesPlans table.
I was under the impression that ORM is smart enough to detect the deletes. I hope that it's just a miss on my end. I'm sure that I'm not the only one doing this.
Thank you
//Profile.cfc
component output="false" persistent="true" table="profiles"
{
property name="profileID" type="numeric" generator="identity";
property name="title" type="string" column="title";
property name="plans" fieldtype="one-to-many" cfc="ProfilePlan" fkcolumn="profileID" structKeyColumn="planID" type="struct" singularname="plan" cascade="all-delete-orphan" inverse="true";
}
}
//Plan.cfc
component extends="Base" persistent="true" output="false" table="plans"
{
property name="planID" type="int" fieldtype="id" generator="native";
property name="name" type="string" ;
}
}
//ProfilePlan.cfc
component persistent="true" output="false" table="profilesPlans"
{
property name="profile" fieldtype="id,many-to-one" fkcolumn="profileID" cfc="Profile" notnull="true" ;
property name="plan" fieldtype="id,many-to-one" fkcolumn="planID" cfc="Plan" invers="true";
Have you tried utilizing the property cascade property directives?
On relationships, cascade can be set to one of the following:
all: Allows you to apply all operations to be cascaded to the associated object.
save-update: If the parent object is saved, the associated objects are saved as well.
delete: Deletes the child object if the delete operation is called on the parent object.
delete-orphan: This is a special kind of cascade option that applies to one-to-many relation only. Deletes all child objects for which the association has been removed.
all-delete-orphan: Cascades all operations to child objects, and performs delete-orphan action.
refresh: Cascades the refresh action to the child object. The refresh action is used to reload an object and its collections.
Typically, cascade attribute is not used on a many-to-one or a many-to-many relationship.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS5FFD2854-7F18-43ea-B383-161E007CE0D1.html#WS7CF54B7A-8F03-47bf-98B5-56FD8B8C858A
--
You received this message because you are subscribed to a topic in the Google Groups "cf-orm-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cf-orm-dev/Gin-Y7FNnbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cf-orm-dev+...@googlegroups.com.