Skip to content

3.5.3

Choose a tag to compare

@peterujah peterujah released this 07 Apr 20:36
· 47 commits to main since this release

Full Changelog: 3.5.2...3.5.3

New Features

Database Query Builder

The Database ORM class introduces new methods to support a wider range of use cases, enhancing flexibility and control over query building and execution.

  • raw - Allows passing raw SQL expressions using the Luminova\Database\RawExpression class.
  • strict - Enables or disables strict mode for WHERE clauses in DELETE or UPDATE queries.
  • having - Adds filtering for grouped results using aggregate functions.
  • isNull - Adds a condition to filter results where the specified column is NULL.
  • isNotNull - Adds a condition to filter results where the specified column is not NULL.
  • notIn - Adds a NOT IN (...) condition to exclude values from the result.
  • conjoin - Groups multiple conditions using AND or OR (e.g., WHERE (a OR b)).
  • nested - Nests multiple grouped conditions using AND/OR logic (e.g., WHERE ((a OR b) AND (c OR d))).
  • column - A helper to create structured column conditions for conjoin and nested, improving readability.
  • onDuplicate - Defines behavior for handling duplicate keys during INSERT operations.
  • ignoreDuplicate - Allows skipping duplicate key errors when inserting records.
  • inTransaction - Returns whether a transaction is currently active.
  • getDebug - Retrieves debug information if debug() was called before executing the query.
  • closeAfter - Enables or disables automatic connection closure after query execution (default: false).

Mailer Helper Class

  • options - Set custom stream context options for the SMTP connection (e.g., SSL/TLS settings).
  • addresses - Add multiple recipients using a comma-separated string, a simple array of emails, or an associative array with name => email format.
  • notification - Specify an email address to receive delivery and read receipt notifications.
  • addHeader - Add custom headers to the outgoing email (e.g., X-Priority, List-Unsubscribe).
  • isHtml - Toggle the email format between HTML and plain text.
  • isMail - Set the transport method to either native mail or SMTP.

Raw SQL Expression

The Luminova\Database\RawExpression class provides a way to include raw SQL expressions without quoting or escaping.

Predefined helper methods are available:

  • now, year, month, day, time - Common time-based SQL functions.
  • count, sum, average - Aggregate functions for grouped data.
  • increment, decrement - SQL math expressions for numeric operations.
  • currents - Returns an array with: currentDate, currentYear, currentMonth, currentDay, currentHour, currentMinute, and currentSecond.

Input Validation Class

  • is_value - Validates that an input field exactly matches the specified value.

Optimizations

Database Query Builder

The query builder received significant performance improvements, including optimized driver initialization and connection management.

  • exec - Method signature changed to static.
  • on - Supports lateral values like '"value"' or raw expressions when joining; any non-expression is treated as a column name.
  • where - Improved to accept arrays for IN (...) and optional NOT for NOT IN (...).
  • datetime - Now supports timezone-aware formatting.
  • returns - Can now return the raw prepared statement using stmt().
  • printDebug - Enhanced to output debug info conditionally based on the environment.
  • insert - Updated to support automatic handling of duplicate key behavior (update or ignore).

Renamed

HTTP Request Class

  • isAJAX → isAjax

Database Query Builder

  • andGroup → andConjoin
  • orGroup → orConjoin
  • andBind → andNested
  • orBind → orNested