zoopcommerce/shard

Soft delete filter

Closed this issue · 5 comments

Hey one more question:

$documentManager->getFilterCollection()->enable('softDelete');

Doesn't seem to be working:

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Filter 'softdelete' does not exist.' in /mnt/www/zoop/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php:90

Do I need to run it with access control? Or has the filter changed it's reference?

My bad for not fixing the docs. There have been some internal changes to abstract out filters. They can be set like this:

use Zoop\Shard\SoftDelete\Extension;

$extension = $manifest->getServiceManager()->get('extension.softdelete');

$extension->setReadFilter(Extension::READ_ONLY_NOT_SOFT_DELETED); //or
$extension->setReadFilter(Extension::READ_ONLY_SOFT_DELETED); //or
$extension->setReadFilter(Extension::READ_ALL);

You don't need access control turned on to filter Soft Delete.

Thanks. All good. I could probably work it out, but I thought it'd be quicker asking you :)

There is working code in all the tests if you ever need to check. :)

ahhhhhhhhhhhhhhhhhhhhhhhhh.

Thanks!