/** * Current picture * /!\ The field must have been fetched even to set a new picture ! * * @param $photo If specified, updates the picture in the database */ public function photo(FrankizImage $photo = null) { if ($photo != null) { if ($this->photo) { $this->photo->delete(); } $this->photo = $photo; XDB::execute('UPDATE account SET photo = {?} WHERE uid = {?}', $photo->id(), $this->id()); } return $this->photo; }