/** * Set record to test. * @param BasicRecord $record Record. */ public function setRecord(BasicRecord $record) { $this->record = $record; $this->model = $record->getModel(); }
/** * Begin a form for a record. End it with {@see end()}. * @param BasicRecord $record A record. * @param array|Linkable|string|null $route Form route, see {@see Routing}. * @param array $attributes Additional attributes for form, see {@see form()}. * used to create the hidden access token field when the method is 'get'. */ public function formFor(BasicRecord $record, $route = array(), $attributes = array()) { $this->record = $record; $this->model = $record->getModel(); $attributes = Html::mergeAttributes(array('id' => $this->model->getName(), 'name' => $this->model->getName()), $attributes); $this->errors = $this->record->getErrors(); $this->form($route, $attributes); }