| @@ 68-86 (lines=19) @@ | ||
| 65 | } |
|
| 66 | ||
| 67 | ||
| 68 | private function createCookie(Entity\CookieIdentity $entity) |
|
| 69 | { |
|
| 70 | $sql = "INSERT INTO {$this->table} |
|
| 71 | (account_id, parent_id, type, status, identifier, fingerprint, hash, created_on, expires_on) |
|
| 72 | VALUES (:account, :parent, :type, :status, :identifier, :fingerprint, :hash, :created, :expires)"; |
|
| 73 | ||
| 74 | $statement = $this->connection->prepare($sql); |
|
| 75 | ||
| 76 | $statement->bindValue(':parent', $entity->getParentId()); |
|
| 77 | $statement->bindValue(':hash', $entity->getHash()); |
|
| 78 | $statement->bindValue(':expires', $entity->getExpiresOn()); |
|
| 79 | $statement->bindValue(':created', time()); |
|
| 80 | ||
| 81 | $this->bindCommonParameters($statement, $entity); |
|
| 82 | ||
| 83 | $statement->execute(); |
|
| 84 | ||
| 85 | $entity->setId($this->connection->lastInsertId()); |
|
| 86 | } |
|
| 87 | ||
| 88 | ||
| 89 | private function updateCookie(Entity\CookieIdentity $entity) |
|
| @@ 112-133 (lines=22) @@ | ||
| 109 | } |
|
| 110 | ||
| 111 | ||
| 112 | private function updateIdentity(Entity\EmailIdentity $entity) |
|
| 113 | { |
|
| 114 | $sql = "UPDATE {$this->table} |
|
| 115 | SET hash = :hash, |
|
| 116 | status = :status, |
|
| 117 | expires_on = :expires, |
|
| 118 | token = :token, |
|
| 119 | token_action = :action, |
|
| 120 | token_expires_on = :token_eol |
|
| 121 | WHERE identity_id = :id"; |
|
| 122 | ||
| 123 | $statement = $this->connection->prepare($sql); |
|
| 124 | ||
| 125 | $statement->bindValue(':id', $entity->getId()); |
|
| 126 | $statement->bindValue(':hash', $entity->getHash()); |
|
| 127 | $statement->bindValue(':status', $entity->getStatus()); |
|
| 128 | $statement->bindValue(':expires', $entity->getExpiresOn()); |
|
| 129 | ||
| 130 | $this->bindToken($statement, $entity); |
|
| 131 | ||
| 132 | $statement->execute(); |
|
| 133 | } |
|
| 134 | ||
| 135 | ||
| 136 | private function bindToken(PDOStatement $statement, Entity\EmailIdentity $entity) |
|