当前位置: 首页>>代码示例>>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;未经允许,请勿转载。