Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function addElementToXml(\SimpleXMLElement $xml, $type, $moduleName) |
||
26 | { |
||
27 | $globalElements = $xml->xpath('/config/global'); |
||
28 | |||
29 | if (!count($globalElements)) { |
||
30 | throw new XmlGeneratorException(sprintf('Global element not found in %s config file', $moduleName)); |
||
31 | } |
||
32 | |||
33 | $modelsElement = $this->getElement($globalElements[0], 'models'); |
||
34 | |||
35 | $modelsClassContainer = $modelsElement->addChild(strtolower($moduleName)); |
||
36 | $modelsClassContainer->addChild('class', $moduleName . '_' . ucfirst($type)); |
||
37 | |||
38 | $resourceElementName = strtolower($moduleName).'_resource'; |
||
39 | if (count($modelsElement->xpath($resourceElementName))) { |
||
40 | $modelsClassContainer->addChild('resourceModel', $resourceElementName); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |