nfx nfx Sun Feb 27 18:35:08 -0500 2011

Subject: Class not found with has_many through

Hey all, kinda new to PHP-AR but am liking it so far.

I've set up the following assocations:
http://pastie.org/1614831

But am getting a class "UserPost" not found error. Which is weird, because I did explicitly set the class_name to be Model_UserPost

As you can notice, the hmvc framework I'm using restricts me to add "Model_" to all of the class names. If I remove Model_ from the class name, it will not autoload (hence I'm not using PHP-AR's autoloader, but the framework's bootstrap functionality instead).

Anyone has a solution for this?


Devi Mandiri Mon Feb 28 06:37:22 -0500 2011

try this:

change

array('posts', 'through' => 'user_posts', 'class_name' => 'Model_Post')

into this:

array('posts', 'through' => 'user_posts', 'source' => 'Model_Post')

edit: oops! sorry,, I didn't read your questions carefully, anyway, this little fix work in kohana framework

Yoan B Wed Mar 23 11:46:10 -0400 2011

I you are putting your models into a namespace, you should also specify it into `class_name`.

(1-2/2)