How to generate Getters and Setters using Skipper External Tools
1./ Install Doctrine2 (it's not even necessary to set up a complete project)
2./ Create an entry in 'External Tools':
* Title:
Generate Getters and Setters
* Command:
cmd /C php "C:/WAMP/www/doctrine2-master/bin/doctrine.php"
* Arguments:
orm:generate-entities --update-entities="true" --generate-methods="true" [path to your entities]"
* Initial Directory:
%PROJECT_DIRECTORY%
3./ Create a Doctrine config file (cli-config.php
) in your project's main folder:
<?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)
));
4./ Launching the 'Generate Getters and Setters' External Tool from the Skipper GUI will generate the required methods.
edit: updated the example based on djandyr's feedback