Exemple #1
0
 /**
  * @param array $fieldList
  *
  * @return array
  */
 protected function prepareFieldList($fieldList)
 {
     $list = array();
     foreach ($fieldList as $fieldName) {
         $list[] = array('name' => $fieldName, 'type' => $this->getEntityItem()->getFieldType($fieldName), 'key' => $this->_translator->getAdminFieldKey($this->getAdminClassName(), $fieldName));
     }
     return $list;
 }
Exemple #2
0
 /**
  * @return string
  */
 public function getGeneratedCode()
 {
     $parameters = null;
     $services = null;
     if ($this->_currentCode) {
         $xmlElement = simplexml_load_string($this->_currentCode);
         /** @var \SimpleXMLElement $tag */
         foreach ($xmlElement as $tag) {
             if ($tag->getName() == 'parameters') {
                 $matches = array();
                 if (preg_match('#<parameters>(.+)\\n\\s*</parameters>#ms', $this->_currentCode, $matches) && isset($matches[1])) {
                     $parameters = $matches[1];
                 }
             } elseif ($tag->getName() == 'services') {
                 $matches = array();
                 if (preg_match('#<services>(.+)\\n\\s*</services>#ms', $this->_currentCode, $matches) && isset($matches[1])) {
                     $services = $matches[1];
                 }
             }
         }
     }
     return $this->getTemplating()->render('MaxmodeGeneratorBundle:Sonata:Admin/services.xml.twig', array('parameters' => $parameters, 'parameterKey' => $this->getAdminServiceClassId(), 'adminClass' => $this->getClassGenerator()->getAdminClassName(), 'services' => $services, 'serviceId' => $this->getAdminServiceId(), 'group' => $this->getGroup(), 'entityClass' => $this->getEntityItem()->getItemClassName(), 'adminCaption' => $this->_translator->getAdminClassKey($this->getClassGenerator()->getAdminClassName())));
 }