public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS)
    {
        $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1';
        $stmt = Database::getConnection('read')->prepare($query);
        $stmt->bindValue(':pid', $projectId);
        $stmt->bindValue(':status', $status);

        if ($stmt->execute()) {
            if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                return new Build($data);
            }
        } else {
            return array();
        }
    }
public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS)
    {
        $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1';
        $stmt = Database::getConnection('read')->prepare($query);
        $stmt->bindValue(':pid', $projectId);
        $stmt->bindValue(':status', $status);

        if ($stmt->execute()) {
            if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                return new Build($data);
            }
        } else {
            return array();
        }
    }
public function getLastBuildByStatus ( $ projectId = null , $ status = Build :: STATUS_SUCCESS ) { $ query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1' ; $ stmt = Database :: getConnection ( 'read' ) -> prepare ( $ query ) ; $ stmt -> bindValue ( ':pid' , $ projectId ) ; $ stmt -> bindValue ( ':status' , $ status ) ; if ( $ stmt -> execute ( ) ) { if ( $ data = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { return new Build ( $ data ) ; } } else { return array ( ) ; } }
Return the latest build for a specific project, of a specific build status.
@param null $projectId
@param int $status
@return array|Build
Return the latest build for a specific project of a specific build status .