public static function validate(BlogMember $blogMember) { $errors = array(); if (!trim($blogMember->getUsername())) { $errors[] = new Error('username', 'Username cannot be empty.'); } if (!trim($blogMember->getPassword())) { $errors[] = new Error('password', 'Password cannot be empty.'); } if (!trim($blogMember->getEmail())) { $errors[] = new Error('email', 'Email cannot be empty.'); } return $errors; }
public static function map(BlogMember $blogMember, array $properties) { if (array_key_exists('member_id', $properties)) { $blogMember->setId($properties['member_id']); } if (array_key_exists('username', $properties)) { $blogMember->setUsername($properties['username']); } if (array_key_exists('email', $properties)) { $blogMember->setEmail($properties['email']); } if (array_key_exists('password', $properties)) { $blogMember->setPassword($properties['password']); } }
private function getParams(BlogMember $blogMember) { $params = array(':member_id' => $blogMember->getId(), ':username' => $blogMember->getUsername(), ':email' => $blogMember->getEmail(), ':password' => $blogMember->getPassword()); // if ($flightBooking->getId()) { // // unset created date, this one is never updated // unset($params[':created_on']); // } return $params; }