Example #1
0
 /**
  * Créer un client à partir d'un tableau associatif ou à partir d'un nom / prénom / email
  * @param type $apiClient
  * @param array|string $arrayOuNom tableau clé / valeur des propriétés du client ou nom du client
  * @param string $prenom [OPTIONNEL] prénom du client
  * @param string $email [OPTIONNEL] email du client
  * @param string $email2[OPTIONNEL] email de confirmation du client. Si non null doit être identique au mail
  * @throws \LogicException si vous ne respectez pas l'une des deux manières d'instancier l'objet
  */
 public function __construct($apiClient, $arrayOuNom, $prenom = NULL, $email = NULL, $email2 = NULL)
 {
     if (is_string($arrayOuNom) && $arrayOuNom && $prenom && $email) {
         //construct à partir de nom, prenom, e-mail, e-mail2
         $arrayOuNom = array("nom" => $arrayOuNom, "prenom" => $prenom, "email" => $email, "email2" => $email2);
     }
     if (is_array($arrayOuNom)) {
         //construction à la manière de faire un restGET
         parent::__construct($apiClient, $arrayOuNom);
     } else {
         throw new \LogicException("Un client peut être instancié à l'aide d'un tableau clé - valeur ou alors son nom, son prénom , son mail et son email de confirmation");
     }
 }
Example #2
0
 /**
  *
  * @param \SitecRESA\WS\Client $apiClient
  * @param array $array tableau associatif avec pour clé les attributs de l'objet. Prestation peut être uniquement son identifiant
  */
 public function __construct($apiClient, $array = NULL)
 {
     if (isset($array["idTarif"])) {
         $array["typeTarif"] = $array["idTarif"];
         unset($array["idTarif"]);
     }
     if (is_numeric($array["prestation"])) {
         //construction par l'intégrateur
         //on construit l'acces resolver.
         $array["prestation"] = new AccesResolver($apiClient, array("idRessource" => $array["prestation"], "verbe" => "get", "methode" => "produit"));
     }
     parent::__construct($apiClient, $array);
     if ($this->_timestampDebut) {
         //depuis WS
         $debut = new \Zend_Date($this->_timestampDebut);
         $fin = new \Zend_Date($this->_timestampFin);
         $this->_debut = $debut->get(\Zend_Date::DAY . "/" . \Zend_Date::MONTH . "/" . \Zend_Date::YEAR);
         $this->_fin = $fin->get(\Zend_Date::DAY . "/" . \Zend_Date::MONTH . "/" . \Zend_Date::YEAR);
     }
 }
Example #3
0
 public function __construct($apiClient, $array = NULL)
 {
     parent::__construct($apiClient, $array);
     $apiClient->setPanier($this);
 }