Code Duplication    Length = 22-22 lines in 2 locations

application/modules/xbanners/models/Base/BannerImageQuery.php 1 location

@@ 212-233 (lines=22) @@
209
     *
210
     * @return ChildBannerImage A model object, or null if the key is not found
211
     */
212
    protected function findPkSimple($key, ConnectionInterface $con)
213
    {
214
        $sql = 'SELECT id, banner_id, target, url, allowed_page, position, active_from, active_to, active, permanent FROM banner_image WHERE id = :p0';
215
        try {
216
            $stmt = $con->prepare($sql);
217
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
218
            $stmt->execute();
219
        } catch (Exception $e) {
220
            Propel::log($e->getMessage(), Propel::LOG_ERR);
221
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
222
        }
223
        $obj = null;
224
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
225
            /** @var ChildBannerImage $obj */
226
            $obj = new ChildBannerImage();
227
            $obj->hydrate($row);
228
            BannerImageTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
229
        }
230
        $stmt->closeCursor();
231
232
        return $obj;
233
    }
234
235
    /**
236
     * Find object by primary key.

application/modules/xbanners/models/Base/BannersQuery.php 1 location

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