protected function parseForms(SimpleXMLElement $xml, Config $config) { /** @var SimpleXmlElement $formXml */ foreach ($xml->xpath("//config:forms/config:form") as $formXml) { $config->addForm(new Form($formXml->getAttributeAsPhp("name"), $formXml->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; }
protected function generateConfig($moduleCode) { $config = new Config(); $config->addForm(new Form(strtolower($moduleCode) . ".configuration", $moduleCode . "\\Form\\" . $moduleCode . "ConfigForm")); return $config; }