Just want to make sure I am on the right path with my first jump into CF9 ORM.
below are two tables. I user can have many monsters assigned to them, and a
monster can belong to many users.
is there anything wrong with below so far?
/**
* monsters
*/
component output="false" persistent="true" {
property name="monster_id" column="monster_id" type="numeric"
ormtype="int" fieldtype="id" generator="increment";
property name="monster_name" column="monster_name" type="string"
ormtype="string" length="100";
property name="monster_des" column="monster_des" type="string"
ormtype="string" length="200";
property name="monster_img1" column="monster_img2" type="string"
ormtype="string" length="100";
property name="monster_img1" column="monster_img2" type="string"
ormtype="string" length="100";
property name="monster_active" column="monster_active"
type="boolean" ormtype="boolean" default="1";
property name="monster_finished" column="monster_finished"
type="boolean" ormtype="boolean" default="1";
/* link tables */
property name="users" singularname="users" fieldtype="many-to-many"
CFC="monsters" linktable="monstersCollected"
FKColumn="user_id" inversejoincolumn="monster_id" lazy="true"
cascade="all" orderby="monster_id";
monsters function init() output=false{
return this;
}
}
/**
* company
*/
component output="false" persistent="true" {
property name="user_id" column="user_id" type="numeric" ormtype="int"
fieldtype="id" generator="increment";
property name="user_name" column="user_name" type="string"
length="120" ormtype="string";
property name="user_email" column="user_email" type="string"
length="250" ormtype="string";
property name="user_password" column="user_password" type="string"
length="200" ormtype="string";
property name="user_created" column="user_created" type="date"
length="200" ormtype="date";
/* link tables */
property name="monsters" singularname="monsters"
fieldtype="many-to-many" CFC="monsters" linktable="monstersCollected"
FKColumn="monster_id" inversejoincolumn="user_id" lazy="true"
cascade="all" orderby="user_id";
users function init() output=false{
return this;
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336693
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm