views:

302

answers:

0

Hello, i just started using PHP namespaces. I have two models classes in separate files

In both files first i declare namespace

namespace eu\ed\sixImport\importViewer\models;

first class:

class Log extends \Doctrine_Record

    $this->hasMany('eu\ed\sixImport\importViewer\models\DataSource as DataSource', array(
        'local' => 'id',
        'foreign' => 'logId'));//setup relationship in setUp method

second class:

class DataSource extends \Doctrine_Record

    $this->hasOne('eu\ed\sixImport\importViewer\models\Log as Log', array(
        'local' => 'logId',
        'foreign' => 'id'));//setup relationship in setUp method

Everything works fine untill i make something like this

    $query = \Doctrine_Query::create()
        ->select('log.*')
        ->from('eu\ed\sixImport\importViewer\models\Log log')
        ->leftJoin("log.DataSource")
        ->orderBy("log.id DESC");

    $requiredPage = (($startingRow - ($startingRow%$rowsRequired))/$rowsRequired) + 1;
    $pager = new \Doctrine_Pager($query, $requiredPage, $rowsRequired);
    $res = $pager->execute();        
    $this->logsPageCount = $pager->getNumResults();
    print_r($res[0]["DataSource"]->toArray());//it fails on access to relationship

Than Doctrine throw Exception Uncaught exception 'Doctrine_Exception' with message 'Couldn't find class eu\ed' in C:\wamp\www\importViewer\resources\doctrine\Doctrine-1.1.5\lib\Doctrine\Table.php:293...

From Exception, you can see, it looks for class 'eu\ed'. Backslash[s] cut the rest of the class name, and than class is not obviously found. Can you give me some suggestion, how to solve this problem?

Thanks