Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$has_many through failing when using namespaces #101

Closed
greut opened this issue Dec 15, 2010 · 2 comments
Closed

$has_many through failing when using namespaces #101

greut opened this issue Dec 15, 2010 · 2 comments

Comments

@greut
Copy link
Collaborator

greut commented Dec 15, 2010

As I already posted this on the forum, PHP-AR fails when the class_name involves namespaced models (it might be here).

<?php

namespace foo\bar\biz;

class User extends \ActiveRecord\Model {
    static $has_many = array(
        array('user_newsletters', 'class_name' => '\foo\bar\biz\UserNewsletter'),
        array('newsletters', 'class_name' => '\foo\bar\biz\Newsletter',
               'through' => 'user_newsletters')
    );
}
// …

$user->newsletters;
// ReflectionException: Class UserNewsletter does not exist

The test is now in this branch.

@greut
Copy link
Collaborator Author

greut commented Dec 17, 2010

More trouble related to it.

$user = User::find(1, array('include' => array('usernewsletters')));

ActiveRecord\DatabaseException: 42S22, 1054, Unknown column 'class_name' in 'where clause'

@greut
Copy link
Collaborator Author

greut commented Dec 23, 2010

The first issue is now working, eager-loading remains though (#107)

greut@8c93932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants