コード例 #1
0
 /**
  * Save {@link Individu}.
  * @param \Air2Java\Model\Individu $individu {@link Individu} to be saved
  * @return \Air2Java\Model\Individu saved {@link Individu} instance
  */
 public function save(\Air2Java\Model\Individu $individu)
 {
     if ($individu->getId() === null) {
         return $this->insert($individu);
     }
     return $this->update($individu);
 }
コード例 #2
0
 /**
  * Maps array to the given {@link Individu}.
  * <p>
  * Expected properties are:
  * <ul>
  *   <li>id</li>
  *   <li>nom</li>
  *   <li>prenom</li>
  *   <li>date_naissance</li>
  * </ul>
  * @param \Air2Java\Model\Individu $individu model
  * @param array $properties to map from.
  */
 public static function map(\Air2Java\Model\Individu $individu, array $properties)
 {
     if (\array_key_exists('id', $properties)) {
         $individu->setId($properties['id']);
     }
     if (\array_key_exists('nom', $properties)) {
         $individu->setNom($properties['nom']);
     }
     if (\array_key_exists('prenom', $properties)) {
         $individu->setPrenom($properties['prenom']);
     }
     if (\array_key_exists('status', $properties)) {
         $individu->setDate_naissance($properties['date_naissance']);
     }
 }
コード例 #3
0
 private function getParams(\Air2Java\model\Individu $user)
 {
     $params = array(':id' => $user->getId(), ':username' => $user->getNom(), ':userpass' => $user->getPassword(), ':userstatus' => $user->getStatus(), ':last_modified_on' => self::formatDateTime($user->getLastModifiedOn()), ':created_on' => self::formatDateTime($user->getCreatedOn()));
     if ($user->getId()) {
         // unset created date, this one is never updated
         unset($params[':created_on']);
     }
     return $params;
 }