Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problems add EAV to ORM model
  • Hi!
    I currently have this model. I've tried to add EAV feature to it, but just after changing the file (and adding a related model) the app crashed. Besides this, nothing changed. What could have gone wrong?
  • HarroHarro
    Accepted Answer
    That is not how EAV works.

    You need to define the a standard has_many relation first, like you would do for any related model. So your Model_Refurbishing is missing a has_many:

            'attributes' => array(
                'key_from' => 'id',
                'model_to' => '\Technician\Model_Refurbishing_Atttribute',
                'key_to' => 'refurbishing_id',
                'cascade_delete' => true,
            )

    And then you define the EAV container by using the same name as the relation, and defining the key and value column names. There is no need to define a model here, it looks like there is a copy/paste error in the docs.

Howdy, Stranger!

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

In this Discussion