Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can you use different namespaces in $_belongs_to
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
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
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion