src/DataStore.php
static function retrieveMostCurrentWorkflowJobByAgeAndStatus($workflow_key, $status, $created_after) {
        $kind_schema = self::getWorkflowJobKind();
        $store = self::store($kind_schema);
        $obsolete_time = new \DateTime($created_after);
        $where = [
            "workflow_key" => $workflow_key,
            "status" => $status,
            "obsolete_time" => $obsolete_time
        ];
        syslog(LOG_INFO, __METHOD__ . " with vars " . json_encode($where));
        $str_query = "SELECT * FROM $kind_schema 
        WHERE workflow_key = @workflow_key AND status = @status AND created > @obsolete_time ORDER BY created DESC";
        $result = $store->fetchOne($str_query, $where);
        if ($result) {
            return $result->getData();
        } else {
            return false;
        }
    }
static function retrieveMostCurrentWorkflowJobByAgeAndStatus($workflow_key, $status, $created_after) {
        $kind_schema = self::getWorkflowJobKind();
        $store = self::store($kind_schema);
        $obsolete_time = new \DateTime($created_after);
        $where = [
            "workflow_key" => $workflow_key,
            "status" => $status,
            "obsolete_time" => $obsolete_time
        ];
        syslog(LOG_INFO, __METHOD__ . " with vars " . json_encode($where));
        $str_query = "SELECT * FROM $kind_schema 
        WHERE workflow_key = @workflow_key AND status = @status AND created > @obsolete_time ORDER BY created DESC";
        $result = $store->fetchOne($str_query, $where);
        if ($result) {
            return $result->getData();
        } else {
            return false;
        }
    }
static function retrieveMostCurrentWorkflowJobByAgeAndStatus ( $ workflow_key , $ status , $ created_after ) { $ kind_schema = self :: getWorkflowJobKind ( ) ; $ store = self :: store ( $ kind_schema ) ; $ obsolete_time = new \ DateTime ( $ created_after ) ; $ where = [ "workflow_key" => $ workflow_key , "status" => $ status , "obsolete_time" => $ obsolete_time ] ; syslog ( LOG_INFO , __METHOD__ . " with vars " . json_encode ( $ where ) ) ; $ str_query = "SELECT * FROM $kind_schema 
        WHERE workflow_key = @workflow_key AND status = @status AND created > @obsolete_time ORDER BY created DESC" ; $ result = $ store -> fetchOne ( $ str_query , $ where ) ; if ( $ result ) { return $ result -> getData ( ) ; } else { return false ; } }
Used to check if job is running and getting last successful job run to retrieve state.

@param $workflow_key
@param $status
@param $created_after
@return array|bool
@throws \Exception
Used to check if job is running and getting last successful job run to retrieve state .