Skip to content

Releases: atlasphp/Atlas.Orm

3.0.0-alpha1

19 Apr 19:45
Compare
Choose a tag to compare
3.0.0-alpha1 Pre-release
Pre-release

Initial release of the 3.x series.

2.2.0

19 Mar 13:37
Compare
Choose a tag to compare

This release adds two "off-interface" events, TableEvents::modifySelect() and
MapperEvents::modifySelect(), to allow modification of the TableSelect and
MapperSelect query objects.

These events are added only to the implementation classes, and not the
interfaces, to make the functionality available without introducing a BC break.
A future major revision may incorporate them into the relevant interfaces.

It also fixes the bug noted at #86
where existing connections are not updated to the current transaction state.

2.1.0

06 Feb 22:31
Compare
Choose a tag to compare

This release adds support for many-to-one relationships by reference (aka "polymorphic association") in addition to some convenience and informational methods.

  • Documentation and code hygiene fixes

  • Add method Mapper\Related::getFields()

  • Add method Mapper\RecordSet::removeAll()

  • Add method Mapper\RecordSet::markForDeletion()

  • Add method Relationship\Relationships::manyToOneByReference()

  • Add method Mapper\AbstractMapper::manyToOneByReference()

2.0.0

17 Oct 12:41
Compare
Choose a tag to compare

Documentation changes and updates.

2.0.0-beta1

03 Oct 13:44
Compare
Choose a tag to compare
2.0.0-beta1 Pre-release
Pre-release

MOTIVATION:

In 1.x, executing a Transaction::persist() will not work properly when the
relationships are mapped across connections that are not the same as the main
record. This is because the Transaction begins on the main record connection,
but does not have access to the connections for related records, and so cannot
track them. The only way to fix this is to introduce a BC break on the Table and
Transaction classes, both their constructors and their internal operations.

As long as BC breaks are on the table, this creates the opportunity to make
other changes, though with an eye to minimizing those changes to reduce the
hassle of moving from 1.x to 2.x.

UPGRADE NOTES FROM 1.x:

  • This package now requires PHP 7.1 or later, and PHPUnit 6.x for development.
    Non-strict typehints have been added throughout, except in cases where they
    might break classes generated from 1.x.

  • You should not need to modify any classes generated from 1.x; however, if
    you have overridden class methods in custom classes, you may need to modify
    that code to add typehints.

  • This package continues to use Aura.Sql and Aura.SqlQuery 2.x; you should not
    need to change any queries.

  • You should not need to change any calls to AtlasContainer for setup.

  • The following methods now return null (instead of false) when they fail.
    You may need to change any logic checking for a strict false return value;
    checking for a loosely false-ish value will continue to work.

    • AbstractMapper::fetchRecord()
    • AbstractMapper::fetchRecordBy()
    • AbstractTable::fetchRow()
    • Atlas::fetchRecord()
    • Atlas::fetchRecordBy()
    • IdentityMap::getRow()
    • MapperInterface::fetchRecord()
    • MapperInterface::fetchRecordBy()
    • MapperSelect::fetchRecord()
    • RecordSet::getOneBy()
    • RecordSet::removeOneBy()
    • RecordSetInterface::getOneBy()
    • RecordSetInterface::removeOneBy()
    • Table::updateRowPerform()
    • TableInterface::fetchRow()
    • TableSelect::fetchOne()
    • TableSelect::fetchRow()

    (N.b.: Values for a single related record are still false, not null.
    That is, null still indicates "there was no attempt to fetch a related
    record," while false still indicates "there was an attempt to fetch a
    related record, but it did not exist.")

  • The following methods will now always return a RecordSetInterface, even when
    no records are found. (Previously, they would return an empty array when no
    records were found.) To check for "no records found", call isEmpty() on the
    returned RecordSetInterface.

    • AbstractMapper::fetchRecordSet()
    • AbstractMapper::fetchRecordSetBy()
    • MapperInterface::fetchRecordSet()
    • MapperInterface::fetchRecordSetBy()
    • MapperSelect::fetchRecordSet()
    • MapperSelect::fetchRecordSetBy()

OTHER CHANGES FROM 1.x:

  • Added Atlas\Orm\Table\ConnectionManager to manage connections at a table-
    specific level.

    • Manages simultaneous transactions over multiple connections.

    • Allows setting of table-specific "read" and "write" connections.

    • Allows on-the-fly replacement of "read" connections with "write"
      connections while writing (useful for synchronizing reads with writes
      while in a transaction) or always (useful for GET-after-POST situations).

    • If the ConnectionManager starts a transaction on one connection (whether
      read or write) then it will start a tranasaction on all connections as
      they are retrieved.

  • AbstractTable now uses the ConnectionManager instead of Aura.Sql
    ConnectionLocator, and does not retain (memoize) the connection objects.
    It retrieves them from the ConnectionManager each time they are needed; this
    helps maintain transaction state across multiple connections.

  • Modified Transaction class to use the ConnectionManager, instead of tracking
    write connections on its own. This makes sure AbstractMapper::persist() will
    work properly with different related connections inside a transaction.

  • The ManyToMany relationship now honors the order of the returned rows.

  • Updated docs and tests.

1.3.2

02 Oct 21:55
Compare
Choose a tag to compare
  • ManyToMany relationship now honors the query order of returned rows. (#76)

  • Fixes to docs and imports

1.3.1

23 Aug 21:09
Compare
Choose a tag to compare
  • AbstractTable::insertRowPerform() now uses the correct sequence name for the last insert ID on Postgres. (#71)

  • Substantial documentation updates and additions; thanks, @jelofson!

1.3.0

29 Jun 16:59
Compare
Choose a tag to compare
  • Changed Mapper::insert() and Mapper::update() to auto-set foreign key values
    on relateds

  • Added Mapper::persist() to insert/update/delete a Record and all its relateds.
    Also available via added Atlas::persist() and Transaction::persist() methods.

  • In AbstractRelationship::fetchForeignRecords() no longer issues an empty IN()
    query if there are no native records to match against. (Fixes #58.)

  • AtlasContainer constructor now accepts a ConnectionLocator as an alternative
    to a PDO object or PDO connection params. (Cf. #63 and #64.)

  • Updated readme, docs and tests.

1.2.1

23 May 15:21
Compare
Choose a tag to compare
  • Docs updates and fixes
  • Fixed error when using PDO in AtlasContainer constructor (#53)

1.2.0

18 Apr 15:01
Compare
Choose a tag to compare
  • Added where() functionality for relationships.