Code Duplication    Length = 22-22 lines in 5 locations

src/cli/Database/Base/ChannelQuery.php 1 location

@@ 169-190 (lines=22) @@
166
     *
167
     * @return ChildChannel A model object, or null if the key is not found
168
     */
169
    protected function findPkSimple($key, ConnectionInterface $con)
170
    {
171
        $sql = 'SELECT id, instance_name, name FROM channel WHERE id = :p0';
172
        try {
173
            $stmt = $con->prepare($sql);
174
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
175
            $stmt->execute();
176
        } catch (Exception $e) {
177
            Propel::log($e->getMessage(), Propel::LOG_ERR);
178
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
179
        }
180
        $obj = null;
181
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
182
            /** @var ChildChannel $obj */
183
            $obj = new ChildChannel();
184
            $obj->hydrate($row);
185
            ChannelTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
186
        }
187
        $stmt->closeCursor();
188
189
        return $obj;
190
    }
191
192
    /**
193
     * Find object by primary key.

src/cli/Database/Base/ConnectionQuery.php 1 location

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

src/cli/Database/Base/InstanceQuery.php 1 location

@@ 179-200 (lines=22) @@
176
     *
177
     * @return ChildInstance A model object, or null if the key is not found
178
     */
179
    protected function findPkSimple($key, ConnectionInterface $con)
180
    {
181
        $sql = 'SELECT name FROM instance WHERE name = :p0';
182
        try {
183
            $stmt = $con->prepare($sql);
184
            $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
185
            $stmt->execute();
186
        } catch (Exception $e) {
187
            Propel::log($e->getMessage(), Propel::LOG_ERR);
188
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
189
        }
190
        $obj = null;
191
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
192
            /** @var ChildInstance $obj */
193
            $obj = new ChildInstance();
194
            $obj->hydrate($row);
195
            InstanceTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
196
        }
197
        $stmt->closeCursor();
198
199
        return $obj;
200
    }
201
202
    /**
203
     * Find object by primary key.

src/cli/Database/Base/SubscriptionQuery.php 1 location

@@ 209-230 (lines=22) @@
206
     *
207
     * @return ChildSubscription A model object, or null if the key is not found
208
     */
209
    protected function findPkSimple($key, ConnectionInterface $con)
210
    {
211
        $sql = 'SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0';
212
        try {
213
            $stmt = $con->prepare($sql);
214
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
215
            $stmt->execute();
216
        } catch (Exception $e) {
217
            Propel::log($e->getMessage(), Propel::LOG_ERR);
218
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
219
        }
220
        $obj = null;
221
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
222
            /** @var ChildSubscription $obj */
223
            $obj = new ChildSubscription();
224
            $obj->hydrate($row);
225
            SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
226
        }
227
        $stmt->closeCursor();
228
229
        return $obj;
230
    }
231
232
    /**
233
     * Find object by primary key.

src/cli/Database/Base/UserQuery.php 1 location

@@ 179-200 (lines=22) @@
176
     *
177
     * @return ChildUser A model object, or null if the key is not found
178
     */
179
    protected function findPkSimple($key, ConnectionInterface $con)
180
    {
181
        $sql = 'SELECT id, instance_name, name FROM user WHERE id = :p0';
182
        try {
183
            $stmt = $con->prepare($sql);
184
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
185
            $stmt->execute();
186
        } catch (Exception $e) {
187
            Propel::log($e->getMessage(), Propel::LOG_ERR);
188
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
189
        }
190
        $obj = null;
191
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
192
            /** @var ChildUser $obj */
193
            $obj = new ChildUser();
194
            $obj->hydrate($row);
195
            UserTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
196
        }
197
        $stmt->closeCursor();
198
199
        return $obj;
200
    }
201
202
    /**
203
     * Find object by primary key.