Exemplo n.º 1
0
 public function registerAction()
 {
     $array = array();
     if ($this->getRequest()->isPost() or $this->getRequest()->isGet()) {
         $field = array('firstname', 'lastname', 'gender', 'address', 'email', 'password', 'city', 'phone');
         foreach ($field as $f) {
             $array[$f] = $this->getParam($f);
         }
         $societe = \Object\Societe::getByReference($this->getParam('reference'), 1);
         if (!$societe instanceof \Object\Societe) {
             throw new \Exception("TXT_REFERENCE_NOT_VALID");
         } else {
             $person = Object\Person::getByEmail($email, 1);
             if (count($person) > 0) {
                 throw new \Exception('TXT_EMAIL_EXIST_ALREADY');
             }
             $societe->createPerson($array);
         }
         //         $person =  Object\Person::create($array);
         //         $person->setKey(\Pimcore\File::getValidFilename($person->getEmail()));
         //         $person->setPublished(true);
         //         $person->setParent(Object\Folder::getByPath("/"));
         //         $person->save();
         $this->forward("login", "login", null, array("email" => $email, "password" => $password));
     }
 }