示例#1
0
 public function setApi(Api $api)
 {
     parent::setApi($api);
     foreach ($this->getItems() as $item) {
         if ($item instanceof AbstractEntity) {
             $item->setApi($api);
         }
     }
 }
 protected function parseForm(AbstractEntity $entity, \DOMElement $formElement)
 {
     $formId = $formElement->attributes->getNamedItem('id')->value;
     $formAction = $formElement->attributes->getNamedItem('action')->value;
     $formMethod = $formElement->attributes->getNamedItem('method')->value;
     $form = new Form($formAction, $formMethod);
     foreach ($this->parseFormFields($formElement) as $key => $value) {
         $form->addField($key, $value);
     }
     $entity->addForm($formId, $form);
     return $entity;
 }