Skip to content

2.2.0

Choose a tag to compare

@dereuromark dereuromark released this 23 Jun 10:09
· 651 commits to master since this release

Included commits: 2.1.2...2.2.0

Improvements

This release improves security of database models, generated by Propel. By default it is not active.

Deployment instructions:

  1. After updating to this version one should configure the new QueryBuilder class in config_propel.php or any other configuration file extending the configuration:
$config[ApplicationConstants::PROPEL] = [
   ....
   'generator' => [
        ....
       'objectModel' => [
           ....
           'builders' => [
               ....
               'query' => '\Spryker\Zed\Propel\Business\Builder\QueryBuilder',
           ],
           ....
      ],
      ....
   ],
   ....
] 
  1. Execute vendor/console/bin propel:install
  2. Check, that all query models were regenerated and AmbiguousComparisonException thrown in their code. This ensures, that filtering is not ambiguous and types match.

Technical details:

  • QueryBuilder builds models in the way, that they now explicitly require specification of filtering criteria, when an array is passed as a filter value or one wants to use LIKE expression.
  • If an ambiguous comparison is detected, a new exception AmbiguousComparisonException is thrown.
  • A new criterion SprykerCriteria::BETWEEN was added to simplify filtering by min and max.
  • Each model, built by the QueryBuilder, now has additional shortcut methods allowing to filter using IN, LIKE or BETWEEN criteria respectively, their names are: filterBy<COLUMN_NAME>_In, filterBy<COLUMN_NAME>_Like and filterBy<COLUMN_NAME>_Between respectively.
  • Behaviour of PropelTypes::PHP_ARRAY column types is not altered and still accepts LIKE-expressions.