I am just starting out using ORM and I'm running into confusion.
Here is my error:
Error Occurred While Processing Request
Repeated column in mapping for entity: skill column: programTypeID (should be mapped with insert="false" update="false")
Here is a basic scenario I am using:
TABLES:
**ProgramType**
programTypeID (PK)
programType varchar(50)
**Skill**
skillID (PK)
Skill varchar(50)
programTypeID(int) (FK)
From my understanding my skill - programtype relationship is a many-to-one... Meaning Many Skills can only have 1 program Type... or 1 program type can be mapped to many skills.
Skill.cfc:
<cfcomponent persistent="true">
<cfproperty name="skillid" fieldType="id" generator="identity">
<cfproperty name="skill" ormType="string">
<cfproperty name="programTypeID" ormType="integer">
<cfproperty name="programType" fieldtype="many-to-one" fkcolumn="programTypeID" cfc="programType">
</cfcomponent>
ProgramType.cfc
<cfcomponent persistent="true" table="programtype">
<cfproperty name="programtypeid" fieldType="id" generator="identity">
<cfproperty name="programtype" ormType="string">
<cfproperty name="skill" fieldType="one-to-many" type="array" cfc="skill" fkcolumn="programTypeID" inverse="true">
</cfcomponent>
SkillEditForm.cfm
<cfoutput>
<form class="form-horizontal" action="submit.cfm" method="post">
<input name="skillid" type="hidden" value="#skill.getSkillid()#">
<div class="control-group">
<label class="control-label" for="programTypeID">Skill</label>
:
<div class="controls">
<select name="programTypeID">
<cfloop index="programType" array="#programTypes#">
<option value="#programType.getProgramTypeID()#"
<cfif programType.getProgramtypeid() eq skillProgramType.getProgramTypeid()>selected</cfif>
>#programType.getProgramType()#</option>
</cfloop>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="skill">Skill</label>
:
<div class="controls">
<input type="text" id="skill" placeholder="" name="skill" value="#skill.getSkill()#">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Submit</button>
</div>
</div>
</form>
</cfoutput>
I find that if I remove programTypeID from the skill.cfc my error goes away. But, my confusion runs in, if programTYpeID is not defined in my CFC, when I go to add or update my entity on the submit.cfc page... how will I set the programTypeID from my select box on the form?