Example #1
-1
 /**
  * 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);
             }
         }
     }
 }
Example #2
-1
 /**
  * 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
     $body = array();
     foreach ($model->attributes() as $key => $value) {
         if (in_array($key, $model->getFileFields())) {
             $this->request->addPostFile($key, $value);
         } else {
             if (!in_array($key, $cantSet)) {
                 $body[$key] = $value !== null ? $value : '';
             }
         }
     }
     $transporter = TransporterFactory::build();
     $transporter->setRequestBody($this, $body);
 }