Code Duplication    Length = 22-22 lines in 2 locations

src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php 1 location

@@ 201-222 (lines=22) @@
198
     *
199
     * @return ChildRecord A model object, or null if the key is not found
200
     */
201
    protected function findPkSimple($key, ConnectionInterface $con)
202
    {
203
        $sql = 'SELECT id, mapUid, nbLaps, score, nbFinish, avgScore, checkpoints, player_id, created_at, updated_at FROM record WHERE id = :p0';
204
        try {
205
            $stmt = $con->prepare($sql);
206
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
207
            $stmt->execute();
208
        } catch (Exception $e) {
209
            Propel::log($e->getMessage(), Propel::LOG_ERR);
210
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
211
        }
212
        $obj = null;
213
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
214
            /** @var ChildRecord $obj */
215
            $obj = new ChildRecord();
216
            $obj->hydrate($row);
217
            RecordTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
218
        }
219
        $stmt->closeCursor();
220
221
        return $obj;
222
    }
223
224
    /**
225
     * Find object by primary key.

src/eXpansion/Framework/PlayersBundle/Model/Base/PlayerQuery.php 1 location

@@ 191-212 (lines=22) @@
188
     *
189
     * @return ChildPlayer A model object, or null if the key is not found
190
     */
191
    protected function findPkSimple($key, ConnectionInterface $con)
192
    {
193
        $sql = 'SELECT id, login, nickname, nickname_stripped, path, wins, online_time, last_online FROM player WHERE id = :p0';
194
        try {
195
            $stmt = $con->prepare($sql);
196
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
197
            $stmt->execute();
198
        } catch (Exception $e) {
199
            Propel::log($e->getMessage(), Propel::LOG_ERR);
200
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
201
        }
202
        $obj = null;
203
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
204
            /** @var ChildPlayer $obj */
205
            $obj = new ChildPlayer();
206
            $obj->hydrate($row);
207
            PlayerTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
208
        }
209
        $stmt->closeCursor();
210
211
        return $obj;
212
    }
213
214
    /**
215
     * Find object by primary key.