magento / community-features

Magento Features Development is an Initiative to Allows Community Memebers Join to Development of Magento Features
46 stars 18 forks source link

Cannot add filter for `NOT FIND_IN_SET` #133

Closed tzyganu closed 3 years ago

tzyganu commented 5 years ago

Moved here from magento/Magento2#20603: As a developer I cannot add a condition to a collection for NOT FIND_IN_SET in the regular way with addAttributeToFilter or addFieldToFilter because Magento\Framework\DB\Adapter\Pdo\Mysql::prepareSqlCondition does not contain a map item for NOT FIND_IN_SET. I always have to do with Zend_Expr approach which is not that "pretty".

Possible solution

Add a new map item in the $conditionKeyMap array from the method mentioned above:

$conditionKeyMap = [
    ...
   'nfinset' => "NOT FIND_IN_SET(?, {{fieldName}})",
];
BarryBadpak commented 4 years ago

This has already been added in https://github.com/magento/magento2/commit/734a43f3ac1a684c60e665009cb5aa7f55d29cf3 and released in 2.3.2

tzyganu commented 4 years ago

@BarryBadpak 2.5h before I posted this. :+1: Someone can see the future. Nice