Exemplo n.º 1
0
 /**
  * @param User $user
  * @throws InvalidParameter
  * @return \CatLab\Accounts\Models\User
  */
 public function create(User $user)
 {
     // Check for duplicate
     if ($this->getFromEmail($user->getEmail())) {
         throw new InvalidParameter("A user with this email address already exists.");
     }
     $data = $this->prepareFields($user);
     // Insert
     $id = Query::insert($this->table_users, $data)->execute();
     $user->setId($id);
     return $user;
 }
 public function create($clientid, $password, $redirect_url, $layout, $userid)
 {
     $data = array('client_id' => $clientid, 'client_secret' => $password, 'redirect_uri' => $redirect_url, 'login_layout' => $layout);
     Query::insert('oauth2_clients', $data)->execute();
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function testNullInsert()
 {
     $query = Query::insert('tableName', array('id' => 1, 'name' => null))->getParsedQuery();
     $this->assertEquals('INSERT INTO `tableName` SET id = 1, name = NULL', $query);
 }
 public function create(DeligatedUser $user)
 {
     if (!$user->getUniqueId() || !$user->getType()) {
         throw new InvalidParameter("All DeligatedUsers must have types and unique ids.");
     }
     $set = $this->getDataToSet($user);
     $set['created_at'] = new DateTime();
     $id = Query::insert('neuron_users_deligated', $set)->execute();
     $user->setId(intval($id));
 }
Exemplo n.º 5
0
 /**
  * @param Email $email
  */
 public function create(Email $email)
 {
     $id = Query::insert('neuron_users_emails', array('u_id' => $email->getUser()->getId(), 'ue_email' => $email->getEmail(), 'ue_verified' => $email->isVerified() ? 1 : 0, 'ue_token' => $email->getToken(), 'ue_expires' => $email->getExpires()))->execute();
     $email->setId(intval($id));
 }