/** * Override writeAttribute to allow for having custom setMethods * * @param string $name * @param string $value * * @return void */ public function writeAttribute($name, $value) { $method = 'set' . ucfirst($name); if (method_exists($this, $method)) { $this->{$method}($value); } else { parent::writeAttribute($name, $value); } }