/** * Function to set POST parameters onto the request * * @param array $params Key value array of post params */ public function setPostParameters($params = array()) { foreach ($params as $key => $value) { $this->request->setPostField($key, $value); } }
/** * Function to set the entities properties on the * request object taking into account any properties that * are read only etc. * * @param \Trucker\Resource\Model */ public function setModelProperties(Model $model) { $cantSet = $model->getReadOnlyFields(); //set the property attributes foreach ($model->attributes() as $key => $value) { if (in_array($key, $model->getFileFields())) { $this->request->addPostFile($key, $value); } else { if (!in_array($key, $cantSet)) { $this->request->setPostField($key, $value); } } } }