Never done much with ORM before, so I thought I'd give it a test, and
getting stuck quite early on!
I have two objects, a User Object and a Company Object.
They're both in the model folder of my coldbox app.
However, I can't get relationships to work at all.
Here's my User Object:
component output="false" persistent="true" {
property name="userID" fieldType="id" type="numeric"
generator="increment";
property name="first_name" type="string" length="50";
property name="surname" type="string" length="50";
property name="email" type="string" length="50";
property name="company" cfc="Company" fieldType="many-to-one"
fkcolumn="companyID";
property name="password" type="string" length="50";
property name="mobilePhone" type="string" length="15";
property name="userType" type="string" default="customer"
notnull="true";
property name="isRegistered" type="boolean" default="false"
notnull="true";
User function init() output=false{
return this;
}
}
And here's my Company Object:
component output="false" persistent="true" {
property name="companyID" fieldType="id" type="numeric"
generator="increment";
property name="name" type="string" length="50";
property name="known_as" type="string" length="50";
property name="email" type="string" length="50";
property name="telephone" type="string" length="50";
Company function init() output=false{
return this;
}
}
Basically, when I start up my app, I get "Cannot find the component
Company".
If I switch the relationships around (and add User into company as
"one-to-many" I get: "Target component User defined for relation user
in cfc Company is not persistent."
Really stuck - anyone got any idea?