$Has_many error

edited March 2015 in Modules
Hello! I'v created two models.

Event_model and Tasks_model

I'v added this string in Event_model
public $has_many = array('tasks' => array(FUEL_FOLDER => 'tasks_model'));

That's all i did.

When i save my Event_model row i get this error:

Unknown column 'Array' in 'field list'

What i forgot to do?

Comments

  • edited 10:24AM
    Where is your tasks_model stored? If it is in the main fuel/application/model directory, then change it to the following:
    public $has_many = array('tasks' => array('app'=> 'tasks_model'));
    OR just:
    public $has_many = array('tasks' => 'tasks_model');
  • edited 10:24AM
    The problem is here:
    VALUES ('', '1', Array, '2015-03-04', '1')
    i suppos it should be string or something in query, but i see PHP Array there
  • edited 10:24AM
    Do you know what the values are suppose to be for the Array? If the field needs to be serialized, you can add the following to your model:
    public $serialized_fields = array('my_field');
    This will serialize the data using JSON and unserialize it when you retrieve it as an array when using find_ methods on the model.
  • edited 10:24AM
    Problem solved. Thank you!
Sign In or Register to comment.