Skip to content

Releases: Planetbiru/MagicObject

3.0.0

24 Feb 02:23

Choose a tag to compare

MagicObject Version 3.0

What's New

  1. SQL Server Database Support
    This feature expands user options by providing support for SQL Server, offering more flexibility in choosing DBMS.

  2. Time Zone Conversion for SQLite and SQL Server Databases
    This feature automatically converts time in databases that do not natively support time zone conversion, such as SQLite and SQL Server.

  3. Database Time Zone Change After Object Construction
    Users can now change the database's time zone at any time as needed. This provides greater flexibility when handling data across multiple time zones, especially when the application is used by users from different time zones, all without the need to modify the application configuration.

  4. Yaml Parser and Dumper
    MagicObject version 3.0 no longer depends on external libraries. The Yaml parsing and dumping functions are now fully handled by a class that is part of MagicObject itself, reducing its overall complexity.

  5. Added BETWEEN Filter for Predicate Queries
    MagicObject now supports BETWEEN filters for predicate-based queries, allowing users to perform range-based filtering efficiently. This improves query performance and simplifies conditions when working with numerical or date ranges.

Full Changelog: 2.16.0...3.0.0

2.16.0

11 Feb 06:31

Choose a tag to compare

What's Changed

Full Changelog: 2.15.7...2.16.0

2.15.0

30 Jan 06:38

Choose a tag to compare

Full Changelog: 2.14.16...2.15.0

2.14.0

11 Jan 12:03

Choose a tag to compare

Full Changelog: 2.13.2...2.14.0

2.13.0

04 Jan 05:45

Choose a tag to compare

Full Changelog: 2.11.7...2.13.0

2.11.0

15 Dec 14:51

Choose a tag to compare

MagicObject Version 2.11

What's New

  1. Dynamic Query Template for Native Queries
    MagicObject now supports dynamic query templates for native SQL queries. This feature allows developers to build SQL queries dynamically, providing flexibility and improving code reusability. The dynamic query template can be customized to suit specific use cases, making it easier to construct complex queries while maintaining cleaner and more maintainable code.

  2. Added DROP TABLE IF EXISTS and CREATE TABLE IF NOT EXISTS to SQL Code Generation
    MagicObject now generates SQL code with DROP TABLE IF EXISTS and CREATE TABLE IF NOT EXISTS statements when creating tables from entities. This ensures that the table creation process is more robust, preventing errors when a table already exists.

  3. Standardization of Annotation Attribute Naming with Camel Case Strategy
    The annotation attributes in MagicObject have been standardized to follow the camel case naming convention, ensuring consistency and better readability throughout the codebase.

  4. Refactoring of Methods with Constant Usage
    To prevent duplication and errors in the code, several methods have been refactored to utilize constants. This improves maintainability and reduces the chances of mistakes during development.

  5. Option to Prettify Serialize for SecretObject
    A new option has been added to allow SecretObject to be serialized with pretty formatting. This makes it easier to read and inspect serialized SecretObject data, especially useful during development or debugging. The prettify flag can be enabled when serializing the object, ensuring the output is more human-readable with proper indentation.

  6. Updated Documentation
    The documentation has been updated to reflect the latest changes in MagicObject. This includes clarifications, examples, and explanations to assist developers in understanding and utilizing the library effectively.

Full Changelog: 2.10.3...2.11.0

2.10.0

10 Dec 01:10

Choose a tag to compare

Full Changelog: 2.9.10...2.10.0

2.9.0

04 Dec 14:48

Choose a tag to compare

Version 2.9

What is New

  • Add database charset
  • Fixing PostgreSQL connection
  • Fixing PostgreSQL script generation
  • Fixing SQLite script generation
  • Fixing database time zone connection
  • Fixing database namespace for PostgreSQL connection

Full Changelog: 2.8.5...2.9.0

2.8.0

24 Nov 04:02

Choose a tag to compare

What's Changed

Full Changelog: 2.7.10...2.8.0

2.7.0

13 Nov 06:01

Choose a tag to compare

MagicObject Version 2.7

What's New

MagicObject 2.7 brings a set of powerful updates to improve database interaction, query flexibility, and transaction management. The main highlights of this release include support for PDO connections, enhanced native query capabilities with pagination and sorting, and new transactional methods for improved data management.

1. PDO Support

One of the most significant changes in MagicObject 2.7 is the introduction of support for PDO (PHP Data Objects). In previous versions, MagicObject required the use of its custom database handler, PicoDatabase. However, to accommodate developers who prefer working with PDO connections, this new version allows users to pass a PDO connection directly to the MagicObject constructor.

Why PDO Support?

The decision to include PDO support was driven by the need to make MagicObject more versatile for developers who are already using PDO in their applications. By allowing PDO connections, MagicObject now supports a broader range of use cases and provides users with the flexibility to integrate with existing PDO-based database connections.

While PDO is supported for the initial connection setup, MagicObject continues to use PicoDatabase for all subsequent database operations. This ensures that users still benefit from PicoDatabase's advanced features, such as automatic query building, database abstraction, and optimized query execution.

How PDO Support Works

In MagicObject 2.7, when you pass a PDO connection object to the constructor, it is internally converted into a PicoDatabase instance via the PicoDatabase::fromPdo() static method. This ensures that although PDO is used for establishing the initial connection, PicoDatabase manages the actual database interactions. Additionally, MagicObject automatically detects the database type based on the PDO driver to ensure smooth operation.

2. Pageable and Sortable in Native Queries

Another important enhancement in MagicObject 2.7 is the introduction of pageable and sortable support in native queries. Prior to this release, native queries lacked direct support for pagination and sorting. Developers had to manually include ORDER BY and LIMIT OFFSET clauses in their queries, leading to more cumbersome code that was difficult to maintain and adapt across different database platforms.

With MagicObject 2.7, you can now pass pagination parameters using the PicoPageable type and sorting parameters using the PicoSortable type directly into your native queries. These parameters can be placed at any point in the query, though it's recommended to position them either at the beginning or end for optimal readability and organization.

This improvement enhances the flexibility of native queries, as the logic for pagination and sorting is handled automatically, reducing the need for manual intervention. By supporting these features, MagicObject 2.7 allows you to write cleaner, more efficient, and database-agnostic queries. You can now easily handle pagination and sorting logic regardless of the underlying database system.

3. Transaction Management

MagicObject 2.7 introduces enhanced support for transactional database operations, including three new methods: startTransaction(), commit(), and rollback(). These methods provide an easy and efficient way to manage database transactions within MagicObject.

  • startTransaction(): Begins a new database transaction.
  • commit(): Commits the current transaction, saving all changes made during the transaction to the database.
  • rollback(): Rolls back the current transaction, undoing any changes made since the transaction began.

These methods are designed to work seamlessly with an active database connection, allowing developers to handle transactions directly within the context of their application. Whether you're managing financial transactions or ensuring data consistency during batch processing, these functions streamline the management of transaction-based operations.

Full Changelog: 2.6.1...2.7.0