Skip to content

Drastically Revamped New Version

Pre-release
Pre-release
Compare
Choose a tag to compare
@rotexdegba rotexdegba released this 04 Dec 04:11
· 227 commits to master since this 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)