Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had to made these changes for the above code to work.. </p> <pre><code>&lt;?php use Doctrine\ORM\Tools\EntityGenerator; ini_set("display_errors", "On"); $libPath = __DIR__; // Set this to where you have doctrine2 installed // autoloaders require_once $libPath . '/Doctrine/Common/ClassLoader.php'; $classLoader = new \Doctrine\Common\ClassLoader('Doctrine', $libPath); $classLoader-&gt;register(); $classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__); $classLoader-&gt;register(); $classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__); $classLoader-&gt;register(); // config $config = new \Doctrine\ORM\Configuration(); $config-&gt;setMetadataDriverImpl($config-&gt;newDefaultAnnotationDriver(__DIR__ . '/Entities')); $config-&gt;setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache); $config-&gt;setProxyDir(__DIR__ . '/Proxies'); $config-&gt;setProxyNamespace('Proxies'); $connectionParams = array( 'path' =&gt; 'test.sqlite3', 'driver' =&gt; 'pdo_sqlite', ); $em = \Doctrine\ORM\EntityManager::create($connectionParams, $config); // 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, __DIR__ . '/Entities'); print 'Done!'; ?&gt; </code></pre> <p>and mysql connection configuration like : </p> <pre><code>$connectionParams = array( 'driver' =&gt; 'pdo_mysql', 'host' =&gt; 'localhost', 'port' =&gt; '3306', 'user' =&gt; 'root', 'password' =&gt; 'root', 'dbname' =&gt; 'database', 'charset' =&gt; 'utf8', ); </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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