/** * 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; }
/** * 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; }