Ejemplo n.º 1
0
 /**
  * Set the value of this field on the associated row, if available.
  *
  * @param mixed $value
  * @return \Dewdrop\Db\Field
  */
 public function setValue($value)
 {
     $this->row->set($this->name, $value);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Apply the supplied default values to the row, skipping any fields
  * that already have a value.
  *
  * @param Row $row
  * @param array $defaults
  * @return $this
  * @throws \Dewdrop\Exception
  */
 public function applyDefaultsToRow(Row $row, array $defaults)
 {
     foreach ($defaults as $key => $value) {
         if (!$row->get($key)) {
             if ($value instanceof FieldInterface) {
                 $value = $value->getValue();
             }
             $row->set($key, $value);
         }
     }
     return $this;
 }