$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|HolidayPolicyRecurringHolidayListFactory */ 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|HolidayPolicyRecurringHolidayListFactory */ function getByCompanyId( $company_id, $where = null, $order = null ) { if ( $company_id == '' ) { return false; } $hpf = new HolidayPolicyFactory(); $ph = [ 'company_id' => TTUUID::castUUID( $company_id ), ]; $query = ' select a.* from ' . $this->getTable() . ' as a LEFT JOIN ' . $hpf->getTable() . ' as hpf ON a.holiday_policy_id = hpf.id where hpf.company_id = ? AND ( hpf.deleted = 0 )'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } /** * @param string $company_id UUID * @param string $recurring_holiday_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|HolidayPolicyRecurringHolidayListFactory * @throws DBError */ function getByCompanyIdAndRecurringHolidayId( $company_id, $recurring_holiday_id, $where = null, $order = null ) { if ( $company_id == '' ) { return false; } if ( $recurring_holiday_id == '' ) { return false; } $hpf = new HolidayPolicyFactory(); $ph = [ 'company_id' => TTUUID::castUUID( $company_id ), 'recurring_holiday_id' => TTUUID::castUUID( $recurring_holiday_id ), ]; $query = ' select a.* from ' . $this->getTable() . ' as a LEFT JOIN ' . $hpf->getTable() . ' as hpf ON a.holiday_policy_id = hpf.id where hpf.company_id = ? AND a.recurring_holiday_id = ? AND ( hpf.deleted = 0 )'; $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|HolidayPolicyRecurringHolidayListFactory */ function getByHolidayPolicyId( $id, $where = null, $order = null ) { if ( $id == '' ) { return false; } //$pgf = new PolicyGroupFactory(); $ph = [ 'id' => TTUUID::castUUID( $id ), ]; $query = ' select a.* from ' . $this->getTable() . ' as a where a.holiday_policy_id = ? '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->rs = $this->ExecuteSQL( $query, $ph ); return $this; } } ?>