]> git.andy128k.dev Git - ipf.git/commitdiff
switch to stable missing-tools
authorAndrey Kutejko <andy128k@gmail.com>
Tue, 19 Mar 2019 23:56:43 +0000 (00:56 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Tue, 19 Mar 2019 23:56:43 +0000 (00:56 +0100)
composer.json
composer.lock
ipf/admin/component.php
ipf/form/field/set.php
ipf/form/widget/settable.php

index 0d10a2abe41d24913dd13881924962f3c7773df4..f4e7e7dee3f38770d823c23896dbd6b6de8d7306 100644 (file)
@@ -19,7 +19,7 @@
     "pear/archive_tar": "1.3.*",
     "doctrine/dbal": "v2.5.13",
     "d11wtq/boris": "dev-master",
-    "andy128k/missing-tools": "0.2.*@dev",
+    "andy128k/missing-tools": "~0.3",
     "andy128k/pegp": "0.2",
     "pimple/pimple": "~3.0",
     "twig/twig": "~1"
index 384c5a30e07c4447b746e2a8c282f14edd4b2225..d13ce29a5d341f7584fed88bbb7f3df2ca8fa2d2 100644 (file)
@@ -4,22 +4,28 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "73a01ff77b33bdec0cab728b7116b494",
+    "content-hash": "73647829ab13dadd59aa63d053c0ab49",
     "packages": [
         {
             "name": "andy128k/missing-tools",
-            "version": "0.2.x-dev",
+            "version": "0.3.x-dev",
             "source": {
                 "type": "git",
-                "url": "git://git.andy128k.net/missing-tools.git",
-                "reference": "5d1ceab2d8b79e9b3823d1444dcff03ca3beebec"
+                "url": "https://github.com/andy128k/missing-tools.git",
+                "reference": "9ba81e33e389cb80b80ce114fb664506fab1859e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/andy128k/missing-tools/zipball/9ba81e33e389cb80b80ce114fb664506fab1859e",
+                "reference": "9ba81e33e389cb80b80ce114fb664506fab1859e",
+                "shasum": ""
             },
             "require": {
                 "andy128k/pegp": "0.2",
-                "php": ">=5.3"
+                "php": ">=5.6"
             },
             "require-dev": {
-                "phpunit/phpunit": "4.4.*"
+                "phpunit/phpunit": "~5"
             },
             "type": "library",
             "autoload": {
                     "src/"
                 ]
             },
-            "scripts": {
-                "test": [
-                    "phpunit ./t"
-                ]
-            },
+            "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "MIT"
             ],
@@ -42,7 +44,7 @@
                 }
             ],
             "description": "Miscellaneous utilities",
-            "time": "2019-03-17T13:31:26+00:00"
+            "time": "2019-03-19T23:50:24+00:00"
         },
         {
             "name": "andy128k/pegp",
             "source": {
                 "type": "git",
                 "url": "https://github.com/twigphp/Twig.git",
-                "reference": "931a8b5cdf99dbe222ca1491e8ce96e674d35882"
+                "reference": "f0efbc5b20bc5fe13119e97fcf8c9e5e6daf9ad1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/931a8b5cdf99dbe222ca1491e8ce96e674d35882",
-                "reference": "931a8b5cdf99dbe222ca1491e8ce96e674d35882",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/f0efbc5b20bc5fe13119e97fcf8c9e5e6daf9ad1",
+                "reference": "f0efbc5b20bc5fe13119e97fcf8c9e5e6daf9ad1",
                 "shasum": ""
             },
             "require": {
             "keywords": [
                 "templating"
             ],
-            "time": "2019-03-16T10:32:43+00:00"
+            "time": "2019-03-19T13:07:27+00:00"
         }
     ],
     "packages-dev": [
     "aliases": [],
     "minimum-stability": "dev",
     "stability-flags": {
-        "d11wtq/boris": 20,
-        "andy128k/missing-tools": 20
+        "d11wtq/boris": 20
     },
     "prefer-stable": false,
     "prefer-lowest": false,
index 3d949c2f30c0034da546406fe389a7fdbe0ce634..2785abc860f81ac7b01c538d8203665d5f8ff063 100644 (file)
@@ -1,8 +1,6 @@
 <?php
 
-use PFF\Functions as F;
 use PFF\HtmlBuilder\Tag as Tag;
-use PFF\Placeholder as P;
 
 interface IPF_Admin_ListFilter
 {
@@ -56,10 +54,10 @@ abstract class IPF_Admin_Component
         if (count(array_diff($what, $this->getPerms($request))))
             return false;
 
-        $authPermissions = F::bind('array_map',
-            F::bind('sprintf', '%s|%s|%s', $this->app->slug(), $this->slug(), P::p()),
-            P::p())
-            ->call($what);
+        $prefix = $this->app->slug() . '|' . $this->slug() . '|';
+        $authPermissions = array_map(function ($action) use ($prefix) {
+            return $prefix . $action;
+        }, $what);
 
         return $this->auth_app->userCan($request->user, $authPermissions);
     }
index cbd9e7acdbfac2ec8ab379a36b48a67d01d6dbc0..b65d9230768316c42a11b830eb3499ab2baf0fad 100644 (file)
@@ -11,7 +11,7 @@ class IPF_Form_Field_Set extends IPF_Form_Field
         if (!$value)
             return $value;
 
-        $errors = new \PFF\MultidimensionalArray;
+        $errors = new \PFF\Map();
 
         $newValue = array();
         foreach ($value as $index => $row) {
@@ -22,7 +22,14 @@ class IPF_Form_Field_Set extends IPF_Form_Field
                 try {
                     $value = $field->clean(\PFF\Arr::get($row, $name));
                 } catch (IPF_Exception_Form $ex) {
-                    $errors->pushToKey(array($index, $name), $ex->getError());
+                    $error = $ex->getError();
+                    $errors->updateOrInsert(
+                        array($index, $name),
+                        function ($arr) use ($error) {
+                            return array_merge($arr, [$error]);
+                        },
+                        [$error]
+                    );
                 }
                 $row[$name] = $value;
             }
index d3a1e255b386d7c98102b71d4046843cb6fbca2f..554f25fb426d3f6515744709dca438859c306417 100644 (file)
@@ -33,7 +33,7 @@ class IPF_Form_Widget_SetTable extends IPF_Form_Widget
 
     public function render($name, $value, $extra_attrs=array())
     {
-        $errors = new \PFF\MultidimensionalArray;
+        $errors = new \PFF\Map;
         foreach (\PFF\Arr::pop($extra_attrs, 'errors', array()) as $e)
             $errors = $e->meta; // TODO: merge
 
@@ -64,11 +64,11 @@ class IPF_Form_Widget_SetTable extends IPF_Form_Widget
         return $table->html();
     }
 
-    protected function renderRow($prefix, $obj, $errors, $index)
+    protected function renderRow($prefix, $obj, \PFF\Map $errors, $index)
     {
         $tr = Tag::tr();
         foreach ($this->widgets as $w) {
-            $cellErrors = $errors->get($index, $w['name']);
+            $cellErrors = $errors->get([$index, $w['name']]);
             $e = IPF_Form::renderErrorsAsHTML($cellErrors);
 
             $val = \PFF\Arr::get($obj, $w['name']);