| @@ 152-173 (lines=22) @@ | ||
| 149 | * |
|
| 150 | * @return ChildTask A model object, or null if the key is not found |
|
| 151 | */ |
|
| 152 | protected function findPkSimple($key, ConnectionInterface $con) |
|
| 153 | { |
|
| 154 | $sql = 'SELECT id, created_at, updated_at FROM tasks WHERE id = :p0'; |
|
| 155 | try { |
|
| 156 | $stmt = $con->prepare($sql); |
|
| 157 | $stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
|
| 158 | $stmt->execute(); |
|
| 159 | } catch (Exception $e) { |
|
| 160 | Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
| 161 | throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
| 162 | } |
|
| 163 | $obj = null; |
|
| 164 | if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
| 165 | /** @var ChildTask $obj */ |
|
| 166 | $obj = new ChildTask(); |
|
| 167 | $obj->hydrate($row); |
|
| 168 | TaskTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
| 169 | } |
|
| 170 | $stmt->closeCursor(); |
|
| 171 | ||
| 172 | return $obj; |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * Find object by primary key. |
|
| @@ 172-193 (lines=22) @@ | ||
| 169 | * |
|
| 170 | * @return ChildUser A model object, or null if the key is not found |
|
| 171 | */ |
|
| 172 | protected function findPkSimple($key, ConnectionInterface $con) |
|
| 173 | { |
|
| 174 | $sql = 'SELECT id, name, email, password, remember_token, created_at, updated_at FROM users WHERE id = :p0'; |
|
| 175 | try { |
|
| 176 | $stmt = $con->prepare($sql); |
|
| 177 | $stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
|
| 178 | $stmt->execute(); |
|
| 179 | } catch (Exception $e) { |
|
| 180 | Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
| 181 | throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
| 182 | } |
|
| 183 | $obj = null; |
|
| 184 | if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
| 185 | /** @var ChildUser $obj */ |
|
| 186 | $obj = new ChildUser(); |
|
| 187 | $obj->hydrate($row); |
|
| 188 | UserTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
| 189 | } |
|
| 190 | $stmt->closeCursor(); |
|
| 191 | ||
| 192 | return $obj; |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * Find object by primary key. |
|