Code Duplication    Length = 22-22 lines in 2 locations

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

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

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

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