コード例 #1
0
 public function __construct(Prototyped $subject)
 {
     $this->subject = $subject;
     $this->map = MappedForm::create($this->subject->proto()->makeForm())->addSource('id', RequestType::get())->setDefaultType(RequestType::post());
     $this->setMethodMapping('drop', 'doDrop')->setMethodMapping('take', 'doTake')->setMethodMapping('save', 'doSave')->setMethodMapping('edit', 'doEdit')->setMethodMapping('add', 'doAdd');
     $this->setDefaultAction('edit');
 }
コード例 #2
0
ファイル: BaseEditor.php プロジェクト: justthefish/hesper
 public function __construct(Prototyped $subject)
 {
     $this->subject = $subject;
     $form = $this->subject->proto()->makeForm()->add(Primitive::choice('action')->setList($this->commandMap)->setDefault($this->defaultAction));
     if ($this->idFieldName) {
         $form->add(Primitive::alias($this->idFieldName, $form->get('id')));
     }
     $this->map = MappedForm::create($form)->addSource('id', RequestType::get())->addSource('action', RequestType::get())->setDefaultType(RequestType::post());
     if ($this->idFieldName) {
         $this->map->addSource($this->idFieldName, RequestType::get());
     }
 }