useQuery complains that can't find model query class #598

aramkarapetian opened this Issue Feb 12, 2013 · 8 comments


None yet

3 participants


replaced line in ModelCriteria::useQuery()
$className = $this->joins[$relationName]->getTableMap()->getPhpName();
$className = $this->joins[$relationName]->getTableMap()->getClassName();
and now it's fine.

Not sure if it's right solution but worked for me.

Propel member

Could you provide a failing testcase?


not sure have that much time.
will try to describe as much as possible
have two tables called client(person alias) and person(personperson alias)
tried to join person to client using aliases
$clientQuery->join('PersonPerson')->useQuery('PersonPerson')-> ...
what I saw it translates alias properly but when tries to autoload class uses PhpName which does not contain namespace as I saw in map class

Propel member

maybe you could post the schema of the related tables..?



<table name="client">
        <column name="id" sqlType="INT(10) UNSIGNED" primaryKey="true" autoIncrement="true" required="true" />
        <column name="status" sqlType="INT(10) UNSIGNED" required="true" defaultValue="2" />

<table name="person">
        <column name="client_id" sqlType="INT(10) UNSIGNED" required="true" primaryKey="true" />
        <foreign-key foreignTable="client" onDelete="CASCADE">
            <reference local="client_id" foreign="id" />

Github hides xml so removed <'s

Propel member

And your query which doesn work..

$this->getQuery(array('PersonPerson')) // returns client query, pre-joined with person and aliased
                                ->where('PersonAccessRight.SystemName = ?', $accessRightName)
Propel member

@aramkarapetian, you can surround your xml by

<code belong here />

to make it visible. I just edited your post.

Propel member

The error is probably in runtime/lib/query/PropelQuery.php +23. Since ModelCriteria::getClassAndAlias returns only the phpName it doen't generate the full php class name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment