Note that there are some explanatory texts on larger screens.

plurals
  1. PODoctrine 2.0.4 Configuration Error?
    primarykey
    data
    text
    <p>I am using doctrine 2.0.4 .i am not sure where exact wrong here any one can help here? </p> <pre><code> &lt;?php error_reporting(E_ALL); ini_set('display_errors', '1'); use Doctrine\Common\ClassLoader, Doctrine\ORM\Configuration, Doctrine\ORM\EntityManager, Doctrine\ORM\Tools\EntityGenerator, Doctrine\Common\Cache\ApcCache, Entities\User,Entity\Address; $RootPath = $_SERVER['DOCUMENT_ROOT'] . '/'; require $RootPath.'doctrine2/Doctrine/Common/ClassLoader.php'; $lib = $RootPath.'doctrine2/'; $lib1 = $RootPath.'MyProject/'; $classLoader = new ClassLoader('Doctrine',$lib); $classLoader-&gt;register(); $classLoader = new ClassLoader('Entities',$lib1); $classLoader-&gt;register(); $classLoader = new ClassLoader('Proxies',$lib1); $classLoader-&gt;register(); $config = new Configuration; $cache= new ApcCache; $driverImpl = $config-&gt;newDefaultAnnotationDriver($lib1.'Entities'); $config-&gt;setMetadataDriverImpl($driverImpl); $config-&gt;setQueryCacheImpl($cache); $config-&gt;setProxyDir($lib1.'Proxies'); $config-&gt;setProxyNamespace('MyProject\Proxies'); $config-&gt;setAutoGenerateProxyClasses(true); $connectionOptions = array( 'driver' =&gt; 'pdo_mysql', 'dbname' =&gt; 'test', 'user' =&gt; 'abc', 'password' =&gt; '123321', 'host' =&gt; '127.0.0.1'); $em = EntityManager::create($connectionOptions, $config); echo "&lt;pre&gt;"; print_r($em); // custom datatypes (not mapped for reverse engineering) /*$em-&gt;getConnection()-&gt;getDatabasePlatform()-&gt;registerDoctrineTypeMapping('set', 'string'); $em-&gt;getConnection()-&gt;getDatabasePlatform()-&gt;registerDoctrineTypeMapping('enum', 'string'); */ // fetch metadata $driver = new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em-&gt;getConnection()-&gt;getSchemaManager() ); $em-&gt;getConfiguration()-&gt;setMetadataDriverImpl($driver); $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em); $cmf-&gt;setEntityManager($em); $classes = $driver-&gt;getAllClassNames(); $metadata = $cmf-&gt;getAllMetadata(); $generator = new EntityGenerator(); $generator-&gt;setUpdateEntityIfExists(true); $generator-&gt;setGenerateStubMethods(true); $generator-&gt;setGenerateAnnotations(true); $generator-&gt;generate($metadata, $lib1 . 'Entities'); echo 'Done'; $q = $em-&gt;createQuery("select u from MyProject\Entities\Dept u "); $users = $q-&gt;getResult(); ?&gt; </code></pre> <p>Resulting in:</p> <pre><code>Error::Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message '[Semantical Error] line 0, col 14 near 'MyProject\Entities\Dept': Error: Class 'MyProject\Entities\Dept' is not defined. Dept.php in Entities code &lt;?php /** * Dept * * @Table(name="dept") * @Entity */ class Dept { /** * @var integer $deptno * * @Column(name="deptno", type="integer", nullable=false) * @Id * @GeneratedValue(strategy="IDENTITY") */ private $deptno; /** * @var string $dname * * @Column(name="dname", type="string", length=50, nullable=false) */ private $dname; /** * @var string $location * * @Column(name="location", type="string", length=50, nullable=false) */ private $location; /** * Get deptno * * @return integer $deptno */ public function getDeptno() { return $this-&gt;deptno; } /** * Set dname * * @param string $dname */ public function setDname($dname) { $this-&gt;dname = $dname; } /** * Get dname * * @return string $dname */ public function getDname() { return $this-&gt;dname; } /** * Set location * * @param string $location */ public function setLocation($location) { $this-&gt;location = $location; } /** * Get location * * @return string $location */ public function getLocation() { return $this-&gt;location; } } and Proxies class not generated here but Entities is generated...where exact wrong here? </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload