Hello,
I'm beginning with Doctrine. I've installed it into my project, I've
created some classes (without namespace) with its mapping configurations
and it works fine :-)
But when I try to define the namespace for some of this classes Doctrine
can't find it :-(
When I add namespace I do this:
//MyClass.php
<?php
namespace MyProject;
class MyClass
{ ...
//MyController.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once "uicmodel/vendor/autoload.php";
$config = Setup::createYAMLMetadataConfiguration(array(__DIR__.
"/../doctrine_config/yaml"), true);
// database configuration parameters
$con = array(
'dbname' => 'db',
'user' => 'myuser',
'password' => '',
'driver' => 'pdo_pgsql',
'host' => 'my-host.com'
);
// obtaining the entity manager
$EntityManager = EntityManager::create($con, $config);
$EntityRepository = $EntityManager->getRepository('MyProject/MyClass');
Even I've tried to modify MyProject/vendor/composer/autoload_namespaces.php
to register this namespace:
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'
),
'Doctrine\\ORM\\' => array($vendorDir . '/doctrine/orm/lib'),
'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/lib'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'
),
'Doctrine\\Common\\Inflector\\' => array($vendorDir .
'/doctrine/inflector/lib'),
'Doctrine\\Common\\Collections\\' => array($vendorDir .
'/doctrine/collections/lib'),
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'
),
'Doctrine\\Common\\Annotations\\' => array($vendorDir .
'/doctrine/annotations/lib'),
'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib'),
'MyProject\\' => array($baseDir . '/src'),
);
Modifying (or not doing) autoload Doctrine laugh an Exception saying it
can't find class MyClass :-(
Any idea? I've searched for long and I can't doing work :-S
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.