Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
Can you use different namespaces in $_belongs_to
fraser
December 2013
The docs say that for the model_to class "it is also expected to be in the same namespace as
the current model".
Does that mean that it's not possible to set model_to to a different namespace, eg
protected static $_belongs_to = array('userAccount' => array(
'key_from' => 'newsitem_username',
'model_to' => '\\Core\\Model_UserAccount',
'key_to' => 'username',
'cascade_save' => true,
'cascade_delete' => false,
// there are some more options for specific relation types
));
Harro
December 2013
Accepted Answer
That is not correct, both for 'model_to' and 'model_from' you can specify a fully namespaced class name. You should not specify the leading backslash, and ucfirst(), so "Core\\Model_Useraccount".
I've updated that text in the docs.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
December 2013