Ver Fonte

[SoftDeleteable] Added some documentation

comfortablynumb há 13 anos atrás
pai
commit
8d641cdfd2

+ 22 - 0
doc/softdeleteable.md

@@ -27,6 +27,28 @@ Read the [documentation](http://github.com/l3pp4rd/DoctrineExtensions/blob/maste
 or check the [example code](http://github.com/l3pp4rd/DoctrineExtensions/tree/master/example)
 on how to setup and use the extensions in most optimized way.
 
+With SoftDeleteable there's one more step you need to do. You need to add the filter to your configuration:
+
+``` php
+
+$config = new Doctrine\ORM\Configuration;
+
+// Your configs..
+
+$config->addFilter('soft-deleteable', 'Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter');
+```
+
+And then you can access the filter from your EntityManager to enable or disable it with the following code:
+
+``` php
+// This will enable the SoftDeleteable filter, so entities which were "soft-deleted" will not appear
+// in results
+$em->getFilters()->enable('soft-deleteable);
+
+// This will disable the SoftDeleteable filter, so entities which were "soft-deleted" will appear in results
+$em->getFilters()->disable('soft-deleteable);
+```
+
 <a name="entity-mapping"></a>
 
 ## SoftDeleteable Entity example:

+ 10 - 1
lib/Gedmo/SoftDeleteable/Query/TreeWalker/SoftDeleteableWalker.php

@@ -12,7 +12,16 @@ use Doctrine\ORM\Query\AST\PathExpression;
 use Gedmo\SoftDeleteable\SoftDeleteableListener;
 
 /**
- * Created by Gustavo Falco <comfortablynumb84@gmail.com>
+ * This SqlWalker is needed when you need to use a DELETE DQL query.
+ * It will update the "deletedAt" field with the actual date, instead
+ * of actually deleting it.
+ *
+ * @author Gustavo Falco <comfortablynumb84@gmail.com>
+ * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
+ * @package Gedmo.Query.TreeWalker
+ * @subpackage SoftDeleteableWalker
+ * @link http://www.gediminasm.org
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
 
 class SoftDeleteableWalker extends SqlWalker