I have two tables that are related by MANY_MANY (so 3 tables really), services and timetables.
I am trying to display an activeListBox in services' _form.php view where it shows the selected timetables.
I have the following:
services model (relations):
_form.php
When I access _form.php via /create it correctly generates the following code:
I have added an afterSave function to my Services model which correctly inserts the appropriate values into the database.
The problem occurs when I try to then update the service (via _form.php) where data exists in the database for that service. I get the following error:
Quote
Object of class Timetables could not be converted to int
From what I can tell, it is trying to compare the Timetables object to the value (int) that exists in the database. I can't work out how to get it to compare timetables->id to the value.
Working based on information in issue 217 I have extended CHtml to let me work with objects.
See attached file.
Place in /protected/components and call via OCHtml::activeListBox($model,$attribute,CHtml::listData(Model::model()->findAll(),$valueField,$textField),array('object'=>$related_attribute));