Soft delete filter
Closed this issue · 5 comments
joshystuart commented
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?
superdweebie commented
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);
superdweebie commented
You don't need access control turned on to filter Soft Delete.
joshystuart commented
Thanks. All good. I could probably work it out, but I thought it'd be quicker asking you :)
superdweebie commented
There is working code in all the tests if you ever need to check. :)
joshystuart commented
ahhhhhhhhhhhhhhhhhhhhhhhhh.
Thanks!