protected function generateModel($modelName, $modelData, ClassMetadata $metadata, Writer $writer)
 {
     $writer->writeln(sprintf("\$%s = new %s();", $modelName, ClassUtils::getClassName($metadata->getName())));
     foreach ($modelData['fields'] as $key => $value) {
         $setter = sprintf('set%s', ucfirst($key));
         $writer->writeln(sprintf("\$%s->%s(%s);", $modelName, $setter, $value));
     }
     foreach ($modelData['associations'] as $assocName => $reference) {
         $this->writeReference($metadata, $modelName, $assocName, $reference, $writer);
     }
     $writer->writeln(sprintf('$manager->persist($%s);', $modelName));
     $writer->writeln(sprintf('$this->addReference(\'%1$s\', $%1$s);', $modelName));
 }
 /**
  * @dataProvider classNameProvider
  */
 public function testGetNamespace($className, $expectedNamespace, $expectedClass)
 {
     $result = ClassUtils::getNamespace($className);
     $this->assertEquals($expectedNamespace, $result);
 }
 /**
  * {@inheritdoc}
  */
 public function modelName($model, ClassMetadata $metadata)
 {
     $identifiers = $metadata->getIdentifierValues($model);
     $className = lcfirst(ClassUtils::getClassName($metadata->getName()));
     return $className . implode('_', $identifiers);
 }