/**
  * @throws \LogicException
  */
 public function run()
 {
     $this->checkInitialization();
     $fs = new Filesystem();
     $fs->remove($this->dirToSaveGeneratedModels);
     $fs->mkdir($this->dirToSaveGeneratedModels);
     if (count($this->entityClassNamesList) === 0) {
         throw new \LogicException("Список с классами сущностей пуст. Задайте список методами ExtJSModelsSaver::addEntitiesToGenerate, ExtJSModelsSaver::addEntityClassToGenerate", self::ERR_LIST_WITH_CLASSES_IS_EMPTY);
     }
     foreach ($this->entityClassNamesList as $className) {
         $dir = null;
         $shortModelName = null;
         $this->parseModelClassToGetDirAndShortNameOfModel($className, $dir, $shortModelName);
         $fs->mkdir($dir);
         $dataToSave = $this->generator->generateMarkupForEntity($className);
         file_put_contents($dir . '/' . $shortModelName . '.js', $dataToSave);
     }
 }
 public function testReferenceDocument()
 {
     $this->service->generateMarkupForEntity('Test\\TestBundle\\Document\\Client');
     $associations = array();
     foreach ($this->twigEngine->renderParameters['associations'] as $assoc) {
         $associations[$assoc['name']] = $assoc;
     }
     $this->assertEquals('Test.document.Order', $associations['orders']['model']);
     $this->assertEquals('orders', $associations['orders']['name']);
     $this->assertEquals('ReferenceMany', $associations['orders']['type']);
     $this->service->generateMarkupForEntity('Test\\TestBundle\\Document\\Order');
     $associations = array();
     foreach ($this->twigEngine->renderParameters['associations'] as $assoc) {
         $associations[$assoc['name']] = $assoc;
     }
     $this->assertEquals('Test.document.Client', $associations['client']['model']);
     $this->assertEquals('client', $associations['client']['name']);
     $this->assertEquals('ReferenceOne', $associations['client']['type']);
 }
 public function testEntityProxy()
 {
     $this->service->generateMarkupForEntity('Test\\TestBundle\\Model\\Person');
     $parameters = $this->twigEngine->renderParameters;
     $this->assertNotNull($parameters['proxy']);
 }