| @@ 20-43 (lines=24) @@ | ||
| 17 | /** |
|
| 18 | * @param Entity\CookieIdentity $entity |
|
| 19 | */ |
|
| 20 | public function fetch(Entity\CookieIdentity $entity) |
|
| 21 | { |
|
| 22 | $sql = "SELECT identity_id AS id, |
|
| 23 | parent_id AS parentId, |
|
| 24 | hash AS hash, |
|
| 25 | expires_on AS expiresOn |
|
| 26 | FROM {$this->table} AS Identities |
|
| 27 | WHERE type = :type |
|
| 28 | AND account_id = :account |
|
| 29 | AND identifier = :identifier |
|
| 30 | AND fingerprint = :fingerprint |
|
| 31 | AND status = :status"; |
|
| 32 | ||
| 33 | $statement = $this->connection->prepare($sql); |
|
| 34 | $this->bindCommonParameters($statement, $entity); |
|
| 35 | ||
| 36 | $statement->execute(); |
|
| 37 | ||
| 38 | $data = $statement->fetch(); |
|
| 39 | ||
| 40 | if ($data) { |
|
| 41 | $this->applyValues($entity, $data); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| 45 | ||
| 46 | private function bindCommonParameters(PDOStatement $statement, Entity\CookieIdentity $entity) |
|
| @@ 63-85 (lines=23) @@ | ||
| 60 | } |
|
| 61 | ||
| 62 | ||
| 63 | private function fetchById(Entity\Identity $entity) |
|
| 64 | { |
|
| 65 | $sql = "SELECT identity_id AS id, |
|
| 66 | parent_id AS parentId, |
|
| 67 | account_id AS accountId, |
|
| 68 | status AS status, |
|
| 69 | hash AS hash, |
|
| 70 | token_expires_on AS tokenEndOfLife |
|
| 71 | FROM {$this->table} |
|
| 72 | WHERE identity_id = :id"; |
|
| 73 | ||
| 74 | $statement = $this->connection->prepare($sql); |
|
| 75 | ||
| 76 | $statement->bindValue(':id', $entity->getId()); |
|
| 77 | ||
| 78 | $statement->execute(); |
|
| 79 | ||
| 80 | $data = $statement->fetch(); |
|
| 81 | ||
| 82 | if ($data) { |
|
| 83 | $this->applyValues($entity, $data); |
|
| 84 | } |
|
| 85 | } |
|
| 86 | ||
| 87 | ||
| 88 | private function fetchByToken(Entity\Identity $entity) |
|