Przeglądaj źródła

Merge pull request #39 from beeldspraak/acl-fix-generate-object-acl-command

acl: fix generate object acl command - only first batch size was saved
Thomas 13 lat temu
rodzic
commit
68d55f7d11
2 zmienionych plików z 6 dodań i 9 usunięć
  1. 1 3
      Resources/config/security.xml
  2. 5 6
      Util/ObjectAclManipulator.php

+ 1 - 3
Resources/config/security.xml

@@ -9,8 +9,6 @@
     </parameters>
 
     <services>
-        <service id="sonata.admin.manipulator.acl.object.orm" class="%sonata.admin.manipulator.acl.object.orm.class%" >
-            <argument type="service" id="sonata.admin.security.handler" />
-        </service>
+        <service id="sonata.admin.manipulator.acl.object.orm" class="%sonata.admin.manipulator.acl.object.orm.class%" />
     </services>
 </container>

+ 5 - 6
Util/ObjectAclManipulator.php

@@ -56,23 +56,22 @@ class ObjectAclManipulator extends BaseObjectAclManipulator
                 // detach from Doctrine, so that it can be Garbage-Collected immediately
                 $em->detach($row[0]);
 
-                if ((++$i % $batchSize) == 0) {
+                $count++;
 
-                    list($batchAdded, $batchUpdated) = $this->configureAcls($admin, $oids, $securityIdentity);
+                if (($count % $batchSize) == 0) {
+                    list($batchAdded, $batchUpdated) = $this->configureAcls($output, $admin, $oids, $securityIdentity);
                     $countAdded += $batchAdded;
                     $countUpdated += $batchUpdated;
                     $oids = array();
                 }
 
-                if ((++$i % $batchSizeOutput) == 0) {
+                if (($count % $batchSizeOutput) == 0) {
                     $output->writeln(sprintf('   - generated class ACEs%s for %s objects (added %s, updated %s)', $objectOwnersMsg, $count, $countAdded, $countUpdated));
                 }
-
-                $count++;
             }
 
             if (count($oids) > 0) {
-                list($batchAdded, $batchUpdated) = $this->configureAcls($admin, $oids, $securityIdentity);
+                list($batchAdded, $batchUpdated) = $this->configureAcls($output, $admin, $oids, $securityIdentity);
                 $countAdded += $batchAdded;
                 $countUpdated += $batchUpdated;
             }