coldfusioncoldboxwirebox

Coldbox Model Relationships


I feel as though I'm missing something, but the Coldbox documentation is such a mess that I can't seem to find how to create relationships between my models.

I have projects, and users. Each a separate table, with a project having a single user matched with a 'userid' column. Very simple.

I'm using Coldbox ActiveEntity with CBORM. I've gotten this far, but it doesn't relate to only that project's user:

Project.cfc

property name="userid" inject="entityService:User";

The above returns all Users, not just the one related to the project I'm referencing it off of.

Coming from a PHP Laravel environment, it's as simple as saying

hasOne(){ return App/User; }

Any help or link to the correct documentation is greatly appreciated. I don't know how Coldbox calls themselves a convention-based framework and then immediately tell you all the different ways that something can be achieved.


Solution

  • This is what I ended up using

    property name="user" cfc="User" fieldtype="one-to-one" fkcolumn="userid" lazy="true" notnull="false";
    

    And her is a link to the documentation:

    ColdFusion ORM Example