Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Non primary key relation triggers New relation set on object wasn't found exception
  • Hello,

    I have two models:

    item { id, lot_id }
    serial { id, lot_id }

    on the serial model, I have a belongs to relation:
    'item' => array(
    'key_from' => 'lot_id',
    'model_to' => 'Model_Item',
    'key_to' => 'lot_id'

    In one of my functions on save the Model_Serial is touched and it triggers an ORM foreign keys check that throws an exception New relation set on Model_Serial object wasn't found. I looked at this code and it seems to always check the relations by primary key (find method) but in my case, the relation is not defined that way.
  • You can not define relations on arbitrary fields, it has to be "foreign key -> primary key". Something else is not supported at the moment.

    If you desire this functionality, please create a feature request for it at

    Although at the moment I don't see an immediate implementation, it is quite a major change.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion