Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** @table invoice_user */
- class UserRepository extends \YetORM\Repository
- {
- public function create($data)
- {
- $this->begin();
- $row = $this->getTable()->insert($data);
- $this->commit();
- return new User($row);
- }
- public function persist(User $user)
- {
- $this->begin();
- $rows = $user->toActiveRow()->update();
- $this->commit();
- return $rows;
- }
- public function findByUser($id)
- {
- $user = $this->getTable()->where('user_id', $id)->fetch();
- if (!$user)
- return NULL;
- return new User($user);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement