src/Context/SQLHandler.php
protected function setLastIdWhere($entity, $criteria)
    {
        $sql = sprintf('SELECT id FROM %s WHERE %s', $entity, $criteria);
        $statement = $this->execute($sql);
        $this->throwErrorIfNoRowsAffected($statement);
        $result = $statement->fetchAll();

        if (! isset($result[0]['id'])) {
            throw new \Exception('Id not found in table.');
        }

        $this->debugLog(sprintf('Last ID fetched: %d', $result[0]['id']));
        $this->handleLastId($entity, $result[0]['id']);

        return $statement;
    }
protected function setLastIdWhere($entity, $criteria)
    {
        $sql = sprintf('SELECT id FROM %s WHERE %s', $entity, $criteria);
        $statement = $this->execute($sql);
        $this->throwErrorIfNoRowsAffected($statement);
        $result = $statement->fetchAll();

        if (! isset($result[0]['id'])) {
            throw new \Exception('Id not found in table.');
        }

        $this->debugLog(sprintf('Last ID fetched: %d', $result[0]['id']));
        $this->handleLastId($entity, $result[0]['id']);

        return $statement;
    }
protected function setLastIdWhere ( $ entity , $ criteria ) { $ sql = sprintf ( 'SELECT id FROM %s WHERE %s' , $ entity , $ criteria ) ; $ statement = $ this -> execute ( $ sql ) ; $ this -> throwErrorIfNoRowsAffected ( $ statement ) ; $ result = $ statement -> fetchAll ( ) ; if ( ! isset ( $ result [ 0 ] [ 'id' ] ) ) { throw new \ Exception ( 'Id not found in table.' ) ; } $ this -> debugLog ( sprintf ( 'Last ID fetched: %d' , $ result [ 0 ] [ 'id' ] ) ) ; $ this -> handleLastId ( $ entity , $ result [ 0 ] [ 'id' ] ) ; return $ statement ; }
Sets the last id by executing a select on the id column.
Sets the last id by executing a select on the id column .