當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserRepository::create方法代碼示例

本文整理匯總了PHP中UserRepository::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRepository::create方法的具體用法?PHP UserRepository::create怎麽用?PHP UserRepository::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserRepository的用法示例。


在下文中一共展示了UserRepository::create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

 public function create($candidate)
 {
     try {
         $userRepository = new UserRepository();
         $candidate->user->accounttype = 0;
         $userRepository->create($candidate->user);
         $null = null;
         $req = $this->db->prepare('INSERT INTO candidates VALUES(:id, :userId, :cvId, :firstname, :lastname, :birthdate, :address, :phone, :email)');
         $req->bindParam(':id', $candidate->id);
         $req->bindParam(':userId', !is_null($candidate->user) ? $candidate->user->id : $null);
         $req->bindParam(':cvId', !is_null($candidate->cv) ? $candidate->cv->id : $null);
         $req->bindParam(':firstname', $candidate->firstname);
         $req->bindParam(':lastname', $candidate->lastname);
         $req->bindParam(':birthdate', $candidate->birthdate);
         $req->bindParam(':address', $candidate->address);
         $req->bindParam(':phone', $candidate->phone);
         $req->bindParam(':email', $candidate->email);
         $req->execute();
     } catch (PDOException $e) {
     }
 }
開發者ID:Ferencz8,項目名稱:temaphp,代碼行數:21,代碼來源:candidateRepository.php

示例2: create

 public function create($company)
 {
     try {
         $userRepository = new UserRepository();
         $company->user->accounttype = 1;
         $userRepository->create($company->user);
         $null = null;
         $req = $this->db->prepare('INSERT INTO companies VALUES(:id, :userId, :name, :description, :address, :phone, :email, :logo, :cities)');
         $req->bindParam(':id', $company->id);
         $req->bindParam(':userId', !is_null($company->user) ? $company->user->id : $null);
         $req->bindParam(':description', $company->description);
         $req->bindParam(':name', $company->name);
         $req->bindParam(':address', $company->address);
         $req->bindParam(':phone', $company->phone);
         $req->bindParam(':email', $company->email);
         $req->bindParam(':logo', $company->logo);
         $req->bindParam(':cities', $company->cities);
         $req->execute();
     } catch (PDOException $e) {
     }
 }
開發者ID:Ferencz8,項目名稱:temaphp,代碼行數:21,代碼來源:companyRepository.php

示例3: UserRepository

 /** @test **/
 function it_persists_the_data_into_the_database()
 {
     $repository = new UserRepository($this->newContainerMock(new User()));
     $repository->create(['name' => 'Finn the Human', 'email' => 'finn.the.human@gmail.com']);
     $user = User::first();
     $this->assertEquals('Finn the Human', $user->name);
     $this->assertEquals('finn.the.human@gmail.com', $user->email);
 }
開發者ID:thirteen,項目名稱:repositories,代碼行數:9,代碼來源:AbstractRepositoryTest.php


注:本文中的UserRepository::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。