hi i have models like : users belongs_to group (users.group = group.id) group has_many fields (fields.group = group.id) fields has_one val (val.fields = fields.id) --- i want search in val.value ! please help
I personally hate this syntax, so I can't comment on it, perhaps something is wrong.
Enable the profiler in your app config.php, enable database profiling in your db.php, and check what query that code generates. Perhaps you can spot the problem?
hi harro,(sorry for my bad english) i have problem with model relation field select. i search in model relation by your help and set selected field from main table (model), but orm select all field in relation. how can i tell orm not select field from model relation?
Remember, an ORM is not a query builder, the ORM is an object representation of your database, and it should not contain partial information.
Although the ORM supports the select() method, using it has a lot of side effects since it will generate incomplete objects. Since the ORM only creates one object for each record, no matter how many times you run a query, you will not be able to access columns that were not part of your initial select.