Example #1
0
 protected function parseLoops(SimpleXMLElement $xml, Config $config)
 {
     /** @var SimpleXmlElement $loopXml */
     foreach ($xml->xpath("//config:loops/config:loop") as $loopXml) {
         $config->addLoop(new Loop($loopXml->getAttributeAsPhp("name"), $loopXml->getAttributeAsPhp("class")));
     }
 }
 /**
  * @param \TheliaStudio\Parser\Entity\Table[] $tables
  */
 protected function generateConfiguration(array $tables, $moduleCode)
 {
     $config = new Config();
     foreach ($tables as $table) {
         // Add loop
         $config->addLoop(new Loop($table->getLoopType(), $moduleCode . "\\Loop\\" . $table->getTableName()));
         // Add forms
         $config->addForm(new Form($table->getRawTableName() . ".create", $moduleCode . "\\Form\\" . $table->getTableName() . "CreateForm"));
         $config->addForm(new Form($table->getRawTableName() . ".update", $moduleCode . "\\Form\\" . $table->getTableName() . "UpdateForm"));
         // Add action
         $service = new Service("action." . strtolower($moduleCode) . "." . $table->getRawTableName() . "_table", $moduleCode . "\\Action\\" . $table->getTableName() . "Action");
         $service->addTag(new Tag("kernel.event_subscriber"));
         $config->addService($service);
         // Add form type
         $formType = new Service(strtolower($moduleCode) . ".form.type." . $table->getRawTableName() . "_id", $moduleCode . "\\Form\\Type\\" . $table->getTableName() . "IdType");
         $formType->addArgument(new Argument(null, Argument::TYPE_SERVICE, "thelia.translator"));
         $formType->addTag(new Tag("thelia.form.type"));
         $config->addService($formType);
     }
     return $config;
 }