$value){ if(!key_exists($key, $_col)){ throw new Exception('Invalid data entry'); }else{ $this->data[$key] = $value; } } } return $this; } public static function getByUser(User $user) { if($user->getAccomodationId()) { $data = Accomodation::fetch(array(['id','=', $user->getAccomodationId()])); if(count($data) === 1){ return $data[0]; } } return false; } }