0 votes

Getters and Setters are generated by Doctrine tools. In order to avoid duplication of the functionality, Skipper will not contain this feature as one of its core functions.

But because of the large interest for this functionality, we have prepared a workaround how to configure External tools to generate Getters and Setters in one click, for this see the answer below.

This was prepared thanks to renaatdemuynck and his Doctrine export schema tutorial.

in How To & Manuals by Skipper developer (74.8k points)

2 Answers

0 votes
Best answer

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:

3./ Create a Doctrine config file (cli-config.php) in your project's main folder:

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);
    new Doctrine\ORM\Mapping\Driver\AnnotationDriver(
        new Doctrine\Common\Annotations\CachedReader(
            new Doctrine\Common\Annotations\AnnotationReader(),
            new Doctrine\Common\Cache\ArrayCache()

$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

by Skipper developer (74.8k points)
edited by

What should be *nix, mac equivalent of cmd /C php "C:/WAMP/www/doctrine2-master/bin/doctrine.php" and %PROJECT_DIRECTORY% ? Is any pre-defined environment variable required?

Unix, Mac equivalent would be:

Command: php /var/www/doctrine2-master/bin/doctrine.php

Initial Directory: $PROJECT_DIRECTORY

No environment variable is necessary.

0 votes

I experienced "No Metadata classes to process" when using this example on a Symfony2 export, due to the namespaced @ORM/ annotations.

  1. Install Doctrine2, recommend using composer
  2. Create an entry in 'External Tools':

    • Title:
    Generate Getters and Setters
    • Command:
    • Arguments:
    orm:generate-entities --update-entities=true --generate-methods=true [path for new entities]
    • Initial Directory:

  3. Create a Doctrine config file, cli-config.php in /tmp/doctrine

by (150 points)
edited by

Sorry, I don't understand what is the question. "No metadata classes to process" isn't ORM Designer/Skipper message, so it's probably Doctrine2 error.

Does your settings work correctly if you execute it manually from the shell? Because Skipper doesn't do anything more than executing configured commands in shell.

Hi Ludek,

The cli-config.php provided in the first answer is incorrect for Symfony2, as the generate getters and setters external tool fails silently.

When executing manually from the shell "No metadata classes to process" is thrown internally by Doctrine2 CLI. The error is due the entities created by Skipper for Symfony2 projects having namespaced annotations.

I provided a cli-config.php which addresses this issue.

Ok, It's a clear now ;-). Thank you for sharing your file.