$filter, ... ). ie: array( 'id' => 1, ... ) * @param array $order Sort order passed to SQL in format of array( $column => 'asc', 'name' => 'desc', ... ). ie: array( 'id' => 'asc', 'name' => 'desc', ... ) * @return $this */ function getAll( $limit = null, $page = null, $where = null, $order = null ) { if ( $order == null ) { $order = [ 'id' => 'asc' ]; $strict = false; } else { $strict = true; } $query = ' select * from ' . $this->getTable() . ' WHERE deleted = 0'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order, $strict ); $this->rs = $this->ExecuteSQL( $query, null, $limit, $page ); return $this; } /** * @param string $id UUID * @param array $where Additional SQL WHERE clause in format of array( $column => $filter, ... ). ie: array( 'id' => 1, ... ) * @param array $order Sort order passed to SQL in format of array( $column => 'asc', 'name' => 'desc', ... ). ie: array( 'id' => 'asc', 'name' => 'desc', ... ) * @return bool|CronJobListFactory */ function getById( $id, $where = null, $order = null ) { if ( $id == '' ) { return false; } //Disable caching, because if its not correct it could cause a cron job to be run multiple times. //$this->rs = $this->getCache( $id ); //if ( $this->rs === false ) { $ph = [ 'id' => TTUUID::castUUID( $id ), ]; $query = ' select * from ' . $this->getTable() . ' where id = ? AND deleted = 0'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); //$this->saveCache( $this->rs, $id ); //} return $this; } /** * @param string $id UUID * @param int $status_id * @param array $where Additional SQL WHERE clause in format of array( $column => $filter, ... ). ie: array( 'id' => 1, ... ) * @param array $order Sort order passed to SQL in format of array( $column => 'asc', 'name' => 'desc', ... ). ie: array( 'id' => 'asc', 'name' => 'desc', ... ) * @return bool|CronJobListFactory */ function getByIdAndStatus( $id, $status_id, $where = null, $order = null ) { if ( $id == '' ) { return false; } if ( $status_id == '' ) { return false; } $ph = [ 'id' => TTUUID::castUUID( $id ), 'status_id' => (int)$status_id, ]; $query = ' select * from ' . $this->getTable() . ' where id = ? AND status_id = ? AND deleted = 0'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } /** * @param $name * @param array $where Additional SQL WHERE clause in format of array( $column => $filter, ... ). ie: array( 'id' => 1, ... ) * @param array $order Sort order passed to SQL in format of array( $column => 'asc', 'name' => 'desc', ... ). ie: array( 'id' => 'asc', 'name' => 'desc', ... ) * @return bool|CronJobListFactory */ function getByName( $name, $where = null, $order = null ) { if ( $name == '' ) { return false; } $ph = [ 'name' => $name, ]; $query = ' select * from ' . $this->getTable() . ' where name = ? AND deleted = 0'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } /** * @return $this */ function getMostRecentlyRun() { $query = ' select * from ' . $this->getTable() . ' WHERE deleted = 0 ORDER BY last_run_date DESC LIMIT 1'; //$query .= $this->getWhereSQL( $where ); //$query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query ); return $this; } /** * @param $lf * @return array|bool */ function getArrayByListFactory( $lf ) { if ( !is_object( $lf ) ) { return false; } $list = []; foreach ( $lf as $obj ) { $list[$obj->getID()] = $obj->getName( true ); } if ( empty( $list ) == false ) { return $list; } return false; } } ?>