You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do have a table that is referenced many-to-many multiple times, here is the relevant schema:
<databasename="default">
<tablename="skill">
<columnname="id"type="INTEGER"primaryKey="true"required="true"autoIncrement="true" />
<columnname="name"type="VARCHAR"size="255"/>
</table>
<tablename="skill_dependency"isCrossRef="true">
<!-- dependency_id depends on parent_id -->
<columnname="dependency_id"type="INTEGER"primaryKey="true"required="true" />
<columnname="parent_id"type="INTEGER"primaryKey="true"required="true" />
<foreign-keyforeignTable="skill"onDelete="cascade"name="skill_dependency_fk_skill"refPhpName="Child">
<referencelocal="dependency_id"foreign="id"/>
</foreign-key>
<foreign-keyforeignTable="skill"onDelete="cascade"name="skill_dependency_fk_parent"refPhpName="Parent">
<referencelocal="parent_id"foreign="id" />
</foreign-key>
</table>
<tablename="skill_part"isCrossRef="true">
<!-- part_id is a part of composite_id -->
<columnname="part_id"type="INTEGER"primaryKey="true"required="true" />
<columnname="composite_id"type="INTEGER"primaryKey="true"required="true" />
<foreign-keyforeignTable="skill"onDelete="cascade"name="skill_part_fk_part"refPhpName="Part">
<referencelocal="part_id"foreign="id" />
</foreign-key>
<foreign-keyforeignTable="skill"onDelete="cascade"name="skill_part_fk_composite"refPhpName="Composite">
<referencelocal="composite_id"foreign="id" />
</foreign-key>
</table>
</database>
This will give me the following methods:
Skill::addParent(SkillDependency)
Skill::addChild(SkillDependency)
Skill::addPart(SkillPart)
Skill::addComposite(SkillPart)
Skill::addSkillRelatedByDependencyId(Skill)
Skill::addSkillRelatedByParentId(Skill)
Skill::addSkillRelatedByPartId(Skill)
Skill::addSkillRelatedByCompositeId(Skill)
which is pretty much the opposite of what I want but correct according to the current name generating strategy. So, I was wondering, that in case of a cross-ref table, the name generation strategy could be twisted to this:
Detect ref-name:
Check for refPhpName on the <foreign-key> element on the crossRef table
Use local attribute on nested <reference> element
Generate collection methods with ref-name (add/get/remove/set)
Generate methods that related to the cross-ref table (with scheme <CrossRefTableName>RelatedBy<RefName>(), e.g. Skill::addSkillDependencyByParent(SkillDependency))
Hey guys,
I do have a table that is referenced many-to-many multiple times, here is the relevant schema:
This will give me the following methods:
Skill::addParent(SkillDependency)
Skill::addChild(SkillDependency)
Skill::addPart(SkillPart)
Skill::addComposite(SkillPart)
Skill::addSkillRelatedByDependencyId(Skill)
Skill::addSkillRelatedByParentId(Skill)
Skill::addSkillRelatedByPartId(Skill)
Skill::addSkillRelatedByCompositeId(Skill)
which is pretty much the opposite of what I want but correct according to the current name generating strategy. So, I was wondering, that in case of a cross-ref table, the name generation strategy could be twisted to this:
refPhpName
on the<foreign-key>
element on the crossRef tablelocal
attribute on nested<reference>
element<CrossRefTableName>RelatedBy<RefName>()
, e.g.Skill::addSkillDependencyByParent(SkillDependency)
)Which would generate these methods:
Skill::addParent(Skill)
Skill::addChild(Skill)
Skill::addComposite(Skill)
Skill::addPart(Skill)
Skill::addSkillDependencyRelatedByParent(SkillDependency)
Skill::addSkillDependencyRelatedByChild(SkillDependency)
Skill::addSkillPartRelatedByPart(SkillPart)
Skill::addSkillPartRelatedByComposite(SkillPart)
They would feel much more "natural" (as if you would do it by hand).
The text was updated successfully, but these errors were encountered: