Code Duplication    Length = 22-22 lines in 2 locations

app/Models/Task/Base/TaskQuery.php 1 location

@@ 142-163 (lines=22) @@
139
     *
140
     * @return ChildTask A model object, or null if the key is not found
141
     */
142
    protected function findPkSimple($key, ConnectionInterface $con)
143
    {
144
        $sql = 'SELECT id, created_at, updated_at FROM tasks WHERE id = :p0';
145
        try {
146
            $stmt = $con->prepare($sql);
147
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
148
            $stmt->execute();
149
        } catch (Exception $e) {
150
            Propel::log($e->getMessage(), Propel::LOG_ERR);
151
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
152
        }
153
        $obj = null;
154
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
155
            /** @var ChildTask $obj */
156
            $obj = new ChildTask();
157
            $obj->hydrate($row);
158
            TaskTableMap::addInstanceToPool($obj, (string) $key);
159
        }
160
        $stmt->closeCursor();
161
162
        return $obj;
163
    }
164
165
    /**
166
     * Find object by primary key.

app/Models/User/Base/UserQuery.php 1 location

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