$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 ) { $query = ' select * from ' . $this->getTable(); $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $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|RecurringPayStubAmendmentUserListFactory */ function getById( $id, $where = null, $order = null ) { if ( $id == '' ) { return false; } $ph = [ 'id' => TTUUID::castUUID( $id ), ]; $query = ' select * from ' . $this->getTable() . ' where id = ? '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } /** * @param string $company_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|RecurringPayStubAmendmentUserListFactory */ function getByCompanyId( $company_id, $where = null, $order = null ) { if ( $company_id == '' ) { return false; } $rpsaf = new RecurringPayStubAmendmentFactory(); $ph = [ 'company_id' => TTUUID::castUUID( $company_id ), ]; $query = ' SELECT a.* FROM ' . $this->getTable() . ' as a LEFT JOIN ' . $rpsaf->getTable() . ' as b ON a.recurring_ps_amendment_id = b.id WHERE b.company_id = ? AND ( b.deleted = 0 ) '; $this->rs = $this->ExecuteSQL( $query, $ph ); 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|RecurringPayStubAmendmentUserListFactory */ function getByRecurringPayStubAmendment( $id, $where = null, $order = null ) { if ( $id == '' ) { return false; } $ph = [ 'id' => TTUUID::castUUID( $id ), ]; $query = ' select * from ' . $this->getTable() . ' where recurring_ps_amendment_id = ? '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); 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|RecurringPayStubAmendmentUserListFactory */ function getByUserId( $id, $where = null, $order = null ) { if ( $id == '' ) { return false; } $ph = [ 'id' => TTUUID::castUUID( $id ), ]; $query = ' select * from ' . $this->getTable() . ' where user_id = ? '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } /** * @param string $id UUID * @param string $user_id UUID * @param array $order Sort order passed to SQL in format of array( $column => 'asc', 'name' => 'desc', ... ). ie: array( 'id' => 'asc', 'name' => 'desc', ... ) * @return bool|RecurringPayStubAmendmentUserListFactory */ function getByIdAndUserId( $id, $user_id, $order = null ) { if ( $id == '' ) { return false; } if ( $user_id == '' ) { return false; } $ph = [ 'user_id' => TTUUID::castUUID( $user_id ), 'id' => TTUUID::castUUID( $id ), ]; $query = ' select * from ' . $this->getTable() . ' where user_id = ? AND id = ? '; $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } } ?>