Exemple #1
0
 public function getStartDate()
 {
     // Initialisation de la date de publication à partir du membre suffixé S (de type string) pour palier au problème
     // de perte des données sur les dates lors de la sérialisation pour le stockage dans le cache
     if ($this->start_date_s) {
         $this->start_date = \Sb\Helpers\DateHelper::createDateTime($this->start_date_s);
     }
     return $this->start_date;
 }
 public static function map(&$facebookUser, array $properties, $prefix = "")
 {
     $facebookUser = new \Sb\Facebook\Model\FacebookUser();
     if (array_key_exists("Id", $properties)) {
         $facebookUser->setId($properties["Id"]);
     }
     if (array_key_exists("uid", $properties)) {
         $facebookUser->setUid($properties["uid"]);
     }
     if (array_key_exists("email", $properties)) {
         $facebookUser->setEmail($properties["email"]);
     }
     if (array_key_exists("first_name", $properties)) {
         $facebookUser->setFirst_name($properties["first_name"]);
     }
     if (array_key_exists("last_name", $properties)) {
         $facebookUser->setLast_name($properties["last_name"]);
     }
     if (array_key_exists("name", $properties)) {
         $facebookUser->setName($properties["name"]);
     }
     if (array_key_exists("sex", $properties)) {
         $facebookUser->setSex($properties["sex"]);
     }
     if (array_key_exists("hometown_location", $properties)) {
         $facebookUser->setHometown_location($properties["hometown_location"]);
     }
     if (array_key_exists("birthday", $properties)) {
         $facebookUser->setBirthday(\Sb\Helpers\DateHelper::createDateTime(date('Y-m-d H:i:s', strtotime($properties["birthday"]))));
     }
     if (array_key_exists("locale", $properties)) {
         $facebookUser->setLocale($properties["locale"]);
     }
     if (array_key_exists("pic_small", $properties)) {
         $facebookUser->setPic_small($properties["pic_small"]);
     }
     if (array_key_exists("pic", $properties)) {
         $facebookUser->setPic($properties["pic"]);
     }
 }
Exemple #3
0
 /**
  * Créé un obj Book à partir du formulaire d'ajout
  * @param \Sb\Db\Model\Book $book
  * @param array $properties
  */
 public static function map(\Sb\Db\Model\Model &$book, array $properties, $prefix = "")
 {
     if (array_key_exists($prefix . 'Author', $properties)) {
         $authorsVal = urldecode($properties[$prefix . 'Author']);
         // testing if the book has more than one author
         $hasMany = strpos($authorsVal, ",") !== false;
         // adding an array of contributor
         $contributors = new \Doctrine\Common\Collections\ArrayCollection();
         if ($hasMany) {
             $authors = explode(",", $authorsVal);
             foreach ($authors as $author) {
                 $contributor = \Sb\Db\Dao\ContributorDao::getInstance()->getByFullName($author);
                 if (!$contributor) {
                     $contributor = new \Sb\Db\Model\Contributor();
                     $contributor->setCreationDate(new \DateTime());
                     $contributor->setLastModificationDate(new \DateTime());
                     $contributor->setFullName($author);
                 }
                 $contributors->add($contributor);
             }
             $book->setContributors($contributors);
         } else {
             // adding just one contributor
             $contributor = \Sb\Db\Dao\ContributorDao::getInstance()->getByFullName($authorsVal);
             if (!$contributor) {
                 $contributor = new \Sb\Db\Model\Contributor();
                 $contributor->setCreationDate(new \DateTime());
                 $contributor->setLastModificationDate(new \DateTime());
                 $contributor->setFullName($authorsVal);
             }
             $contributors->add($contributor);
             $book->setContributors($contributors);
         }
     }
     if (array_key_exists($prefix . 'Language', $properties)) {
         $book->setLanguage(urldecode($properties[$prefix . 'Language']));
     }
     if (array_key_exists($prefix . 'Description', $properties)) {
         $book->setDescription(urldecode($properties[$prefix . 'Description']));
     }
     if (array_key_exists($prefix . 'ISBN10', $properties)) {
         $book->setISBN10($properties[$prefix . 'ISBN10']);
     }
     if (array_key_exists($prefix . 'ISBN13', $properties)) {
         $book->setISBN13($properties[$prefix . 'ISBN13']);
     }
     if (array_key_exists($prefix . 'ASIN', $properties)) {
         $book->setASIN($properties[$prefix . 'ASIN']);
     }
     if (array_key_exists($prefix . 'Id', $properties)) {
         $book->setId($properties[$prefix . 'Id']);
     }
     if (array_key_exists($prefix . 'ImageBinary', $properties)) {
         $book->setImageBinary($properties[$prefix . 'ImageBinary']);
     }
     if (array_key_exists($prefix . 'ImageUrl', $properties)) {
         $book->setImageUrl($properties[$prefix . 'ImageUrl']);
     }
     if (array_key_exists($prefix . 'LargeImageUrl', $properties)) {
         $book->setLargeImageUrl($properties[$prefix . 'LargeImageUrl']);
     }
     if (array_key_exists($prefix . 'SmallImageUrl', $properties)) {
         $book->setSmallImageUrl($properties[$prefix . 'SmallImageUrl']);
     }
     if (array_key_exists($prefix . 'Publisher', $properties)) {
         $publisherVal = urldecode($properties[$prefix . 'Publisher']);
         $publisher = \Sb\Db\Dao\PublisherDao::getInstance()->getByName($publisherVal);
         if (!$publisher) {
             $publisher = new \Sb\Db\Model\Publisher();
             $publisher->setCreationDate(new \DateTime());
             $publisher->setLastModificationDate(new \DateTime());
             $publisher->setName($publisherVal);
         }
         $book->setPublisher($publisher);
     }
     if (array_key_exists($prefix . 'Title', $properties)) {
         $book->setTitle(urldecode($properties[$prefix . 'Title']));
     }
     if (array_key_exists($prefix . 'CreationDate', $properties)) {
         $book->setCreationDate(\Sb\Helpers\DateHelper::createDateTime($properties[$prefix . 'CreationDate']));
     }
     if (array_key_exists($prefix . 'LastModificationDate', $properties)) {
         $book->setLastModificationDate(\Sb\Helpers\DateHelper::createDateTime($properties[$prefix . 'LastModificationDate']));
     }
     if (array_key_exists($prefix . 'PublishingDate', $properties)) {
         $book->setPublishingDate(\Sb\Helpers\DateHelper::createDateTime($properties[$prefix . 'PublishingDate']));
     }
     if (array_key_exists($prefix . 'AmazonUrl', $properties)) {
         $book->setAmazonUrl(urldecode($properties[$prefix . 'AmazonUrl']));
     }
     if (array_key_exists($prefix . 'NbOfPages', $properties)) {
         $book->setNb_of_pages($properties[$prefix . 'NbOfPages']);
     }
 }
Exemple #4
0
 public function getReadingDate()
 {
     if ($this->reading_date_s) {
         $this->reading_date = \Sb\Helpers\DateHelper::createDateTime($this->reading_date_s);
     }
     return $this->reading_date;
 }
Exemple #5
0
 public function getLastModificationDate()
 {
     if ($this->last_modification_date_s) {
         $this->last_modification_date = \Sb\Helpers\DateHelper::createDateTime($this->last_modification_date_s);
     }
     return $this->last_modification_date;
 }