Skip to content

Releases: rotexsoft/leanorm

Maintenance Release

13 May 04:08
Compare
Choose a tag to compare
  • Added
    • \LeanOrm\Model::fetchOneByPkey($id, array $relations_to_include = []): ?\GDAO\Model\RecordInterface
    • and \LeanOrm\Model\Collection::getData(): array

Full Changelog: 3.0.0...3.0.1

Maintenance Release

13 May 04:05
Compare
Choose a tag to compare
  • Added
    • \LeanOrm\Model::fetchOneByPkey($id, array $relations_to_include = []): ?\GDAO\Model\RecordInterface
    • and \LeanOrm\Model\Collection::getData(): array

Full Changelog: 2.2.4...2.2.5

New Major Release

09 May 04:38
Compare
Choose a tag to compare
  • Updated the aura/sqlquery dependency to the latest version 3.0.0+
  • Deprecated Utils::search2D(...) in 2.X has been removed in this version
  • Apart from the two changes above, I will strive to maintain the same features across the latest 2.X & 3.X version
  • The next version 4.X will have a minimum requirement of PHP 8.1. 2.X & 3.X both require a minimum of PHP 7.4

Full Changelog: 2.2.4...3.0.0

Performance Improvements

28 Feb 00:11
Compare
Choose a tag to compare
  • More improvement of algorithm for stitching eager fetched related data into parent records.

Full Changelog: 2.2.3...2.2.4

Performance Improvements

25 Feb 12:11
Compare
Choose a tag to compare
  • Improved algorithm for stitching eager fetched related data into parent records.

  • If the table_cols array is pre-populated with a table / view column meta data array in a Model class, the Model constructor will no longer query the info schema for table column metadata, thereby reducing the number of run time sql queries. It is up to the developer to make sure future modifications to the table / view columns are reflected in the hard-coded array in the appropriate Model classes.

  • Deprecated Utils::search2D as it's no longer used anywhere in the package, will be removed in version 3.0.0

Full Changelog: 2.2.2...2.2.3

Minor Enhancement

16 Feb 00:10
Compare
Choose a tag to compare
  • Under the hood query building enhancement

Full Changelog: 2.2.1...2.2.2

Minor Enhancement

27 Jan 23:32
Compare
Choose a tag to compare
  • Updated Documentation
  • Added a new \LeanOrm\CachingModel class, which is a sub-class of \LeanOrm\Model
    • this new class is supposed to cache method return values where possible to improve performance & eliminate / reduce duplicate queries
  • Forced PHPUnit Tests to run in a specified order. I know that the best practice is for tests to run independently of each other, but because there are fair amount of static methods in the DBConnector class, its tests need to be run first before other Test Classes. Would need to manually add new Test files to the phpunit.xml.dist file moving forward.
    Full Changelog: 2.2.0...2.2.1

First Stable 2.x Release

21 Jan 00:36
Compare
Choose a tag to compare

First Stable 2.x Release and first ever stable release of this package. It is strongly recommended that you use this version or higher of this package and totally ignore all the prior release candidate versions.

  • Updated Class Diagrams

  • Moved out all Exception Classes from Exceptions.php into their own individual Exception class files

  • Added more type hinting to the following methods

    • Model::loadRelationshipData(...)
    • Model::loadHasMany(...)
    • Model::loadHasManyTrough(...)
    • Model::loadHasOne(...)
    • Model::loadBelongsTo(...)
    • Model::getColValsFromArrayOrCollection(...)
    • Model::wrapRelatedDataInsideRecordsAndCollection(...)
    • Model::throwExceptionForInvalidDeleteQueryArg(...)
  • Renamed \LeanOrm\CantUpdateReadOnlyRecordException to \LeanOrm\CantSaveReadOnlyRecordException

  • Collection::deleteAll() returns an array of keys in the collection for the records that could not be deleted instead of returning the primary key values of those records.

  • Collection::saveAll(...) now throws \LeanOrm\CantSaveReadOnlyRecordException instead of \LeanOrm\CantDeleteReadOnlyRecordFromDBException when it's called on a collection that contains one or more ReadOnlyRecords

  • Collection::saveAll(...) throws \LeanOrm\Model\TableNameMismatchInCollectionSaveAllException if a record belonging to a table different from the table the model associated with the collection belongs to

  • Collection::toArray() has been refactored to return an array for which each item is the return value of calling toArray() on each record in the array

  • A trait named \LeanOrm\Model\CommonRecordCodeTrait has been added and it contains code that is shared between \LeanOrm\Model\Record & \LeanOrm\Model\ReadOnlyRecord. The record classes are now shorter in length

  • All unit tests have been written

  • Lots of other under the hood enhancements

  • Updated Documentation. Will still be improving documentation, so check the master branch for the latest documentation.

  • Also see release notes for each of the 2.1.x-RC versions for other changes

  • Full Changelog: 1.1.1-RC2...2.2.0

More API Cleanup

05 Dec 18:29
Compare
Choose a tag to compare
More API Cleanup Pre-release
Pre-release

The two Model methods updateSpecifiedRecord & updateMatchingDbTableRows now return self

Drastically Revamped New Version

04 Dec 04:11
Compare
Choose a tag to compare
Pre-release
  • This new 2.x version is totally incompatible with the 1.x versions
  • Now using Github Actions for continuous integration
  • Not using Travis CI anymore
  • BSD 3 license
  • Minimum PHP version 7.4
  • Incorporated Injecting a PSR / Log logger for logging Queries
  • Added atlas/info version ^1.2 under the hood for help in getting Postgresql metadata
  • Yanked out a lot of no longer needed code
  • Changed Query building mechanism to use the \Aura\SqlQuery Select classes for modifying queries used in the various fetch methods.
    • There is now a \LeanOrm\Model->getSelect() that creates the appropriate Select query object that can be injected into the fetch methods.
  • Some Exception classes have been yanked out
<?php
    class StringHelperException extends \Exception {}
    class ModelPropertyNotDefinedException extends \Exception{}
    class ModelBadColsParamSuppliedException extends \Exception{}
    class ModelBadWhereParamSuppliedException extends \Exception{}
    class ModelBadFetchParamsSuppliedException extends \Exception{}
    class ModelBadHavingParamSuppliedException extends \Exception{}
    class ModelBadGroupByParamSuppliedException extends \Exception{}
    class ModelBadOrderByParamSuppliedException extends \Exception{}
    class ModelBadWhereOrHavingParamSuppliedException extends \Exception{}
    class ModelBadCollectionClassNameForFetchingRelatedDataException extends \Exception{}
    class ModelBadRecordClassNameForFetchingRelatedDataException extends \Exception{}
    class ModelRelatedModelNotCreatedException extends \Exception{}
  • New Exception classes were added
<?php
namespace LeanOrm {
    class UnsupportedPdoServerVersionException extends \Exception{}
    class BadModelColumnNameException extends \Exception{}
    class BadModelClassNameForFetchingRelatedDataException extends \Exception{}
    class BadModelTableNameException extends \Exception{}
    class BadModelPrimaryColumnNameException extends \Exception{}
    class BadCollectionClassNameForFetchingRelatedDataException extends \Exception{}
    class BadRecordClassNameForFetchingRelatedDataException extends \Exception{}
    class RelatedModelNotCreatedException extends \Exception{}
    class InvalidArgumentException extends \InvalidArgumentException{}
}
  • More Strict typing all over the code base
  • Added Query Logging capabilities to the Model class
  • Changed the Model constructor signature from:
    public function __construct(
        $dsn = '', 
        $username = '', 
        $passwd = '', 
        array $pdo_driver_opts = array(),
        array $extra_opts = array()
    )

to

    public function __construct(
        string $dsn = '', 
        string $username = '', 
        string $passwd = '', 
        array $pdo_driver_opts = [],
        string $primary_col_name='',
        string $table_name=''
    ) 
  • No longer using \GDAO\Model\RecordsList to create collections of records.
  • Lots of public method signature changes, especially the fetch* methods
  • Added four new methods to \LeanOrm\Model for defining relationships
    • belongsTo(...)
    • hasMany(...)
    • hasManyThrough(...)
    • hasOne(...)
  • Changed the constructor signature for \LeanOrm\Model\Collection from:
    public function __construct(
        \GDAO\Model\RecordsList $data, \GDAO\Model $model, array $extra_opts=array()
    ) 

to

    public function __construct(
        \GDAO\Model $model, \GDAO\Model\RecordInterface ...$data
    ) 
  • Changed the signature for \LeanOrm\Model\Collection::loadData from:
    public function loadData(\GDAO\Model\RecordsList $data_2_load)

to

    public function loadData(\GDAO\Model\RecordInterface ...$data_2_load): self
  • Changed the constructor signature for \LeanOrm\Model\Record & \LeanOrm\Model\ReadOnlyRecord from:
    public function __construct(array $data, \GDAO\Model $model, array $extra_opts=array())

to

    public function __construct(array $data, \GDAO\Model $model)