コード例 #1
0
ファイル: Fiches.php プロジェクト: mejt/Krauza
 public function insert(Fiche $fiche)
 {
     return $this->storage->query(function ($pdo, $operations) use($fiche) {
         $dbClass = $operations . '\\ModifyData';
         $data = ['id' => $fiche->getId(), 'group_id' => $fiche->getGroup()->getId(), 'word' => $fiche->getWord(), 'explain_word' => $fiche->getExplainWord()];
         return $dbClass::insert($pdo, 'fiche', $data);
     });
 }
コード例 #2
0
ファイル: UserFiches.php プロジェクト: mejt/Krauza
 public function fetchByFicheForUser(UserEntity $user, Fiche $fiche) : UserFicheStatus
 {
     $result = $this->storage->query(function ($pdo, $operations) use($user, $fiche) {
         $dbClass = $operations . '\\FetchData';
         return $dbClass::getRow($pdo, ['*'], 'user_fiche', ['user_id' => $user->getId(), 'fiche_id' => $fiche->getId()]);
     });
     $userGroup = new UserGroup($user, $fiche->getGroup(), $this);
     return new UserFicheStatus($fiche, $userGroup, $result['level'], new \DateTime($result['last_modified']), $result['archived']);
 }