Skip to content

Instantly share code, notes, and snippets.

@djandyr
Last active August 29, 2015 14:04
Show Gist options
  • Save djandyr/a3a996560a3e6ea34f9f to your computer and use it in GitHub Desktop.
Save djandyr/a3a996560a3e6ea34f9f to your computer and use it in GitHub Desktop.
Skipper18: Generate Getters and Setters
<?php
require_once "vendor/autoload.php";
// The path to your entities generated by skipper18
$entityPath = array(__DIR__."/Entities");
$config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($entityPath, true);
$config->setMetadataDriverImpl(
new Doctrine\ORM\Mapping\Driver\AnnotationDriver(
new Doctrine\Common\Annotations\CachedReader(
new Doctrine\Common\Annotations\AnnotationReader(),
new Doctrine\Common\Cache\ArrayCache()
),
$entityPath
)
);
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite'
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
$helpers = new Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment