"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"
"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"
],
}
],
"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,
<?php
-use PFF\Functions as F;
use PFF\HtmlBuilder\Tag as Tag;
-use PFF\Placeholder as P;
interface IPF_Admin_ListFilter
{
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);
}
if (!$value)
return $value;
- $errors = new \PFF\MultidimensionalArray;
+ $errors = new \PFF\Map();
$newValue = array();
foreach ($value as $index => $row) {
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;
}
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
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']);