]> git.andy128k.dev Git - ipf.git/commitdiff
use DBAL
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jan 2018 16:06:23 +0000 (17:06 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jan 2018 18:49:20 +0000 (19:49 +0100)
composer.json
composer.lock
ipf/auth/admin.php
ipf/auth/app.php
ipf/auth/models.php
ipf/database.php
ipf/project.php

index 0874deffdb1434829002225e040279706d4de34c..e563502fa46c1ef3f78c14f76205c841590ea8ff 100644 (file)
@@ -17,7 +17,7 @@
   },
   "require": {
     "pear/archive_tar": "1.3.*",
-    "lichtner/fluentpdo": "1.1.*",
+    "doctrine/dbal": "v2.5.13",
     "d11wtq/boris": "dev-master",
     "andy128k/missing-tools": "0.2.*@dev",
     "andy128k/migrations": "dev-master",
index 0553aba9c24931989ba2396c2bdcbb6673f23912..62e7c8efcc48e5f6a4e291f9d73e3abc9f8ed3d3 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "c68dc1cd6de1610baf682073b30a07ba",
+    "content-hash": "71d3b77fb8f02b910c3394b968ee56ad",
     "packages": [
         {
             "name": "andy128k/ipf-legacy-template",
             "source": {
                 "type": "git",
                 "url": "https://github.com/isocra/TableDnD.git",
-                "reference": "796260929c1f00079520c2454bb83b31cfc72e48"
+                "reference": "338bbc52587d00352d6680073842dfbea8a04aa3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/isocra/TableDnD/zipball/796260929c1f00079520c2454bb83b31cfc72e48",
-                "reference": "796260929c1f00079520c2454bb83b31cfc72e48",
+                "url": "https://api.github.com/repos/isocra/TableDnD/zipball/338bbc52587d00352d6680073842dfbea8a04aa3",
+                "reference": "338bbc52587d00352d6680073842dfbea8a04aa3",
                 "shasum": ""
             },
             "require": {
                     "dev-master": "0.9.1-dev"
                 }
             },
-            "time": "2015-01-13T20:19:46+00:00"
+            "time": "2018-01-14T13:06:17+00:00"
         },
         {
             "name": "bower-asset/jquery",
-            "version": "2.2.1",
+            "version": "2.2.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/jquery/jquery-dist.git",
-                "reference": "788eaba2f83e7b7445c7a83a50c81c0704423874"
+                "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/788eaba2f83e7b7445c7a83a50c81c0704423874",
-                "reference": "788eaba2f83e7b7445c7a83a50c81c0704423874",
+                "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72",
+                "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72",
                 "shasum": ""
             },
             "type": "bower-asset-library",
                 "javascript",
                 "jquery",
                 "library"
-            ]
+            ],
+            "time": "2016-05-20T17:24:43+00:00"
         },
         {
             "name": "bower-asset/jquery-ui",
-            "version": "1.11.4",
+            "version": "1.12.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/components/jqueryui.git",
-                "reference": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1"
+                "reference": "44ecf3794cc56b65954cc19737234a3119d036cc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/components/jqueryui/zipball/c34f8dbf3ba57b3784b93f26119f436c0e8288e1",
-                "reference": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1",
+                "url": "https://api.github.com/repos/components/jqueryui/zipball/44ecf3794cc56b65954cc19737234a3119d036cc",
+                "reference": "44ecf3794cc56b65954cc19737234a3119d036cc",
                 "shasum": ""
             },
             "require": {
                     "jquery-ui.js"
                 ],
                 "bower-asset-ignore": []
-            }
+            },
+            "license": [
+                "MIT"
+            ],
+            "time": "2016-09-16T05:47:55+00:00"
         },
         {
             "name": "bower-asset/jqueryui-timepicker-addon",
             "source": {
                 "type": "git",
                 "url": "https://github.com/trentrichardson/jQuery-Timepicker-Addon.git",
-                "reference": "3c9065e400bbf6014fbdcc1b857cf502364e2938"
+                "reference": "f9415cdac7516c1f8beff0ceb99c8f913915c7e2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/trentrichardson/jQuery-Timepicker-Addon/zipball/3c9065e400bbf6014fbdcc1b857cf502364e2938",
-                "reference": "3c9065e400bbf6014fbdcc1b857cf502364e2938",
+                "url": "https://api.github.com/repos/trentrichardson/jQuery-Timepicker-Addon/zipball/f9415cdac7516c1f8beff0ceb99c8f913915c7e2",
+                "reference": "f9415cdac7516c1f8beff0ceb99c8f913915c7e2",
                 "shasum": ""
             },
             "type": "bower-asset-library",
             "extra": {
-                "branch-alias": {
-                    "dev-master": "1.5.0-dev"
-                }
+                "bower-asset-main": [
+                    "dist/jquery-ui-timepicker-addon.js",
+                    "dist/jquery-ui-timepicker-addon.css"
+                ],
+                "bower-asset-ignore": [
+                    "/CONTRIBUTING.md",
+                    "/Gruntfile.js",
+                    "/README.md",
+                    "/composer.json",
+                    "/jquery-ui-timepicker-addon.json",
+                    "/lib",
+                    "/package.json",
+                    "/src",
+                    "/test"
+                ]
             },
-            "time": "2014-09-01T15:02:31+00:00"
+            "time": "2016-04-20T19:26:28+00:00"
         },
         {
             "name": "bower-asset/tinymce-dist",
-            "version": "4.3.4",
+            "version": "4.7.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/tinymce/tinymce-dist.git",
-                "reference": "4db115aff381c7e881193eede8cb8d8172d01963"
+                "reference": "256a571d890d4e15da618019994f072cd43209bc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/4db115aff381c7e881193eede8cb8d8172d01963",
-                "reference": "4db115aff381c7e881193eede8cb8d8172d01963",
+                "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/256a571d890d4e15da618019994f072cd43209bc",
+                "reference": "256a571d890d4e15da618019994f072cd43209bc",
                 "shasum": ""
             },
             "type": "bower-asset-library",
                 "richtext",
                 "tinymce",
                 "wysiwyg"
-            ]
+            ],
+            "time": "2018-01-22T13:09:23+00:00"
         },
         {
             "name": "d11wtq/boris",
             "time": "2015-10-23T08:04:46+00:00"
         },
         {
-            "name": "lichtner/fluentpdo",
-            "version": "v1.1.2",
+            "name": "doctrine/annotations",
+            "version": "dev-master",
             "source": {
                 "type": "git",
-                "url": "https://github.com/envms/fluentpdo.git",
-                "reference": "2bb54b27e6d53c35329ac7e651d869ac52f1944a"
+                "url": "https://github.com/doctrine/annotations.git",
+                "reference": "fe71864318b4912198a317783392c639221ec2fd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/envms/fluentpdo/zipball/2bb54b27e6d53c35329ac7e651d869ac52f1944a",
-                "reference": "2bb54b27e6d53c35329ac7e651d869ac52f1944a",
+                "url": "https://api.github.com/repos/doctrine/annotations/zipball/fe71864318b4912198a317783392c639221ec2fd",
+                "reference": "fe71864318b4912198a317783392c639221ec2fd",
                 "shasum": ""
             },
+            "require": {
+                "doctrine/lexer": "1.*",
+                "php": "^7.1"
+            },
+            "require-dev": {
+                "doctrine/cache": "1.*",
+                "phpunit/phpunit": "^6.4"
+            },
             "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.7.x-dev"
+                }
+            },
             "autoload": {
-                "files": [
-                    "FluentPDO/FluentPDO.php"
-                ]
+                "psr-4": {
+                    "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
+                }
+            ],
+            "description": "Docblock Annotations Parser",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "annotations",
+                "docblock",
+                "parser"
+            ],
+            "time": "2017-12-24T17:33:14+00:00"
+        },
+        {
+            "name": "doctrine/cache",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/cache.git",
+                "reference": "e3fcea0d1af20ec7e236e37efaca378071adbae0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/cache/zipball/e3fcea0d1af20ec7e236e37efaca378071adbae0",
+                "reference": "e3fcea0d1af20ec7e236e37efaca378071adbae0",
+                "shasum": ""
+            },
+            "require": {
+                "php": "~7.1"
+            },
+            "conflict": {
+                "doctrine/common": ">2.2,<2.4"
+            },
+            "require-dev": {
+                "alcaeus/mongo-php-adapter": "^1.1",
+                "doctrine/coding-standard": "^1.0",
+                "mongodb/mongodb": "^1.1",
+                "phpunit/phpunit": "^6.3",
+                "predis/predis": "~1.0",
+                "squizlabs/php_codesniffer": "^3.0"
+            },
+            "suggest": {
+                "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.8.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
+                }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
-                "Apache-2.0",
-                "GPL-2.0+"
+                "MIT"
             ],
             "authors": [
                 {
-                    "name": "envms",
-                    "homepage": "http://env.ms"
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
                 }
             ],
-            "description": "FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.",
-            "homepage": "https://github.com/envms/fluentpdo",
+            "description": "Caching library offering an object-oriented API for many cache backends",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "cache",
+                "caching"
+            ],
+            "time": "2017-12-18T07:23:23+00:00"
+        },
+        {
+            "name": "doctrine/collections",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/collections.git",
+                "reference": "ba63bf914b56e21989eeb99d36bed219900f37c1"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/collections/zipball/ba63bf914b56e21989eeb99d36bed219900f37c1",
+                "reference": "ba63bf914b56e21989eeb99d36bed219900f37c1",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.1"
+            },
+            "require-dev": {
+                "doctrine/coding-standard": "^1.0",
+                "phpunit/phpunit": "^6.3",
+                "squizlabs/php_codesniffer": "^3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.6.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
+                }
+            ],
+            "description": "Collections Abstraction library",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "array",
+                "collections",
+                "iterator"
+            ],
+            "time": "2017-12-22T05:53:34+00:00"
+        },
+        {
+            "name": "doctrine/common",
+            "version": "2.7.x-dev",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/common.git",
+                "reference": "df88fc88463a60f228a8233acf3fa8664897229c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/common/zipball/df88fc88463a60f228a8233acf3fa8664897229c",
+                "reference": "df88fc88463a60f228a8233acf3fa8664897229c",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/annotations": "1.*",
+                "doctrine/cache": "1.*",
+                "doctrine/collections": "1.*",
+                "doctrine/inflector": "1.*",
+                "doctrine/lexer": "1.*",
+                "php": "~5.6|~7.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^5.4.6"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.7.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Common\\": "lib/Doctrine/Common"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
+                }
+            ],
+            "description": "Common Library for Doctrine projects",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "annotations",
+                "collections",
+                "eventmanager",
+                "persistence",
+                "spl"
+            ],
+            "time": "2017-07-22T08:35:55+00:00"
+        },
+        {
+            "name": "doctrine/dbal",
+            "version": "v2.5.13",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/dbal.git",
+                "reference": "729340d8d1eec8f01bff708e12e449a3415af873"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873",
+                "reference": "729340d8d1eec8f01bff708e12e449a3415af873",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/common": ">=2.4,<2.8-dev",
+                "php": ">=5.3.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "4.*",
+                "symfony/console": "2.*||^3.0"
+            },
+            "suggest": {
+                "symfony/console": "For helpful console commands such as SQL execution and import of files."
+            },
+            "bin": [
+                "bin/doctrine-dbal"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.5.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Doctrine\\DBAL\\": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                }
+            ],
+            "description": "Database Abstraction Layer",
+            "homepage": "http://www.doctrine-project.org",
             "keywords": [
-                "builder",
                 "database",
-                "db",
                 "dbal",
-                "fluent",
-                "mysql",
-                "oracle",
-                "pdo",
-                "query"
+                "persistence",
+                "queryobject"
+            ],
+            "time": "2017-07-22T20:44:48+00:00"
+        },
+        {
+            "name": "doctrine/inflector",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/inflector.git",
+                "reference": "7344124551d4c40ab77c4b58647234c5676aa27b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/inflector/zipball/7344124551d4c40ab77c4b58647234c5676aa27b",
+                "reference": "7344124551d4c40ab77c4b58647234c5676aa27b",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.1"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^6.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Benjamin Eberlei",
+                    "email": "kontakt@beberlei.de"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Jonathan Wage",
+                    "email": "jonwage@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
+                }
+            ],
+            "description": "Common String Manipulations with regard to casing and singular/plural rules.",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "inflection",
+                "pluralize",
+                "singularize",
+                "string"
+            ],
+            "time": "2018-01-12T11:45:27+00:00"
+        },
+        {
+            "name": "doctrine/lexer",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/lexer.git",
+                "reference": "cc709ba91eee09540091ad5a5f2616727662e41b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/lexer/zipball/cc709ba91eee09540091ad5a5f2616727662e41b",
+                "reference": "cc709ba91eee09540091ad5a5f2616727662e41b",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Roman Borschel",
+                    "email": "roman@code-factory.org"
+                },
+                {
+                    "name": "Guilherme Blanco",
+                    "email": "guilhermeblanco@gmail.com"
+                },
+                {
+                    "name": "Johannes Schmitt",
+                    "email": "schmittjoh@gmail.com"
+                }
             ],
-            "time": "2017-10-13T15:23:44+00:00"
+            "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+            "homepage": "http://www.doctrine-project.org",
+            "keywords": [
+                "lexer",
+                "parser"
+            ],
+            "time": "2017-07-24T09:37:08+00:00"
         },
         {
             "name": "pear/archive_tar",
         }
     ],
     "packages-dev": [
+        {
+            "name": "doctrine/instantiator",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/instantiator.git",
+                "reference": "8520afa0d55f9b3aba1070a9bf65d4b0d9fb7727"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8520afa0d55f9b3aba1070a9bf65d4b0d9fb7727",
+                "reference": "8520afa0d55f9b3aba1070a9bf65d4b0d9fb7727",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.1"
+            },
+            "require-dev": {
+                "ext-pdo": "*",
+                "ext-phar": "*",
+                "phpunit/phpunit": "^6.2.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Marco Pivetta",
+                    "email": "ocramius@gmail.com",
+                    "homepage": "http://ocramius.github.com/"
+                }
+            ],
+            "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+            "homepage": "https://github.com/doctrine/instantiator",
+            "keywords": [
+                "constructor",
+                "instantiate"
+            ],
+            "time": "2017-12-22T05:44:00+00:00"
+        },
         {
             "name": "phpunit/php-code-coverage",
             "version": "2.2.x-dev",
         },
         {
             "name": "phpunit/php-timer",
-            "version": "dev-master",
+            "version": "1.0.x-dev",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-timer.git",
-                "reference": "d107f347d368dd8a384601398280c7c608390ab7"
+                "reference": "9513098641797ce5f459dbc1de5a54c29b0ec1fb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/d107f347d368dd8a384601398280c7c608390ab7",
-                "reference": "d107f347d368dd8a384601398280c7c608390ab7",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/9513098641797ce5f459dbc1de5a54c29b0ec1fb",
+                "reference": "9513098641797ce5f459dbc1de5a54c29b0ec1fb",
                 "shasum": ""
             },
             "require": {
             "keywords": [
                 "timer"
             ],
-            "time": "2017-03-07T15:42:04+00:00"
+            "time": "2018-01-06T05:27:16+00:00"
+        },
+        {
+            "name": "phpunit/php-token-stream",
+            "version": "1.4.x-dev",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+                "reference": "58bd196ce8bc49389307b3787934a5117db80fea"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/58bd196ce8bc49389307b3787934a5117db80fea",
+                "reference": "58bd196ce8bc49389307b3787934a5117db80fea",
+                "shasum": ""
+            },
+            "require": {
+                "ext-tokenizer": "*",
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Wrapper around PHP's tokenizer extension.",
+            "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+            "keywords": [
+                "tokenizer"
+            ],
+            "time": "2017-12-04T15:11:28+00:00"
         },
         {
             "name": "phpunit/phpunit",
             ],
             "time": "2015-10-02T06:51:40+00:00"
         },
+        {
+            "name": "sebastian/comparator",
+            "version": "1.2.x-dev",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/comparator.git",
+                "reference": "18a5d97c25f408f48acaf6d1b9f4079314c5996a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/18a5d97c25f408f48acaf6d1b9f4079314c5996a",
+                "reference": "18a5d97c25f408f48acaf6d1b9f4079314c5996a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "sebastian/diff": "~1.2",
+                "sebastian/exporter": "~1.2 || ~2.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.4"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Jeff Welch",
+                    "email": "whatthejeff@gmail.com"
+                },
+                {
+                    "name": "Volker Dusch",
+                    "email": "github@wallbash.com"
+                },
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@2bepublished.at"
+                },
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Provides the functionality to compare PHP values for equality",
+            "homepage": "http://www.github.com/sebastianbergmann/comparator",
+            "keywords": [
+                "comparator",
+                "compare",
+                "equality"
+            ],
+            "time": "2017-03-07T10:34:43+00:00"
+        },
         {
             "name": "sebastian/diff",
-            "version": "dev-master",
+            "version": "1.4.x-dev",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/diff.git",
-                "reference": "0fd4d14dd707808a95ca67ada62c15f9a9186b15"
+                "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/0fd4d14dd707808a95ca67ada62c15f9a9186b15",
-                "reference": "0fd4d14dd707808a95ca67ada62c15f9a9186b15",
+                "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
+                "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0"
+                "php": "^5.3.3 || ^7.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "^6.2"
+                "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.1-dev"
+                    "dev-master": "1.4-dev"
                 }
             },
             "autoload": {
             "keywords": [
                 "diff"
             ],
-            "time": "2017-12-14T13:13:00+00:00"
+            "time": "2017-05-22T07:24:03+00:00"
         },
         {
             "name": "sebastian/environment",
-            "version": "dev-master",
+            "version": "1.3.x-dev",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/environment.git",
-                "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf"
+                "reference": "67f55699c2810ff0f2cc47478bbdeda8567e68ee"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
-                "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
+                "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/67f55699c2810ff0f2cc47478bbdeda8567e68ee",
+                "reference": "67f55699c2810ff0f2cc47478bbdeda8567e68ee",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0"
+                "php": "^5.3.3 || ^7.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "~4.4"
+                "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
             },
             "type": "library",
             "extra": {
                 "environment",
                 "hhvm"
             ],
-            "time": "2016-02-26T18:40:46+00:00"
+            "time": "2017-02-28T08:18:59+00:00"
         },
         {
             "name": "sebastian/exporter",
         },
         {
             "name": "sebastian/recursion-context",
-            "version": "dev-master",
+            "version": "1.0.x-dev",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/recursion-context.git",
-                "reference": "0f7f5eb7697036c570aff6812a8efe60c417725e"
+                "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0f7f5eb7697036c570aff6812a8efe60c417725e",
-                "reference": "0f7f5eb7697036c570aff6812a8efe60c417725e",
+                "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
+                "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0"
+                "php": ">=5.3.3"
             },
             "require-dev": {
-                "phpunit/phpunit": "^6.0"
+                "phpunit/phpunit": "~4.4"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "3.0.x-dev"
+                    "dev-master": "1.0.x-dev"
                 }
             },
             "autoload": {
             ],
             "description": "Provides functionality to recursively process PHP variables",
             "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
-            "time": "2017-11-16T10:04:08+00:00"
+            "time": "2016-10-03T07:41:43+00:00"
         },
         {
             "name": "sebastian/version",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/yaml.git",
-                "reference": "968ef42161e4bc04200119da473077f9e7015128"
+                "reference": "be720fcfae4614df204190d57795351059946a77"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/yaml/zipball/968ef42161e4bc04200119da473077f9e7015128",
-                "reference": "968ef42161e4bc04200119da473077f9e7015128",
+                "url": "https://api.github.com/repos/symfony/yaml/zipball/be720fcfae4614df204190d57795351059946a77",
+                "reference": "be720fcfae4614df204190d57795351059946a77",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Yaml Component",
             "homepage": "https://symfony.com",
-            "time": "2017-11-29T09:33:18+00:00"
+            "time": "2018-01-03T07:36:31+00:00"
         }
     ],
     "aliases": [],
index c814c54dc70f9be360fed433d812b32f8897a148..c8ad689937b2e689723eebe9f89ecb2869d576b8 100644 (file)
@@ -80,7 +80,7 @@ class UserForm extends \IPF_ObjectForm
             $this->fields['roles'] = new \IPF_Form_Field_MultipleChoice(array(
                 'label'     => __('Groups'),
                 'help_text' => __('In addition to the permissions manually assigned, this user will also get all permissions granted to each group he/she is in.'),
-                'choices'   => Role::query()->fetchPairs('name', 'id'),
+                'choices'   => array_column(Role::all(), 'id', 'name'),
                 'widget'    => 'IPF_Form_Widget_SelectMultipleInputCheckbox',
                 'widget_attrs' => array('class' => 'checkgroup'),
             ));
@@ -144,7 +144,7 @@ abstract class Component extends \IPF_Admin_Component
             throw new \Exception('Admin application is not registered.');
 
         $choices = array();
-        foreach (Permission::query()->fetchAll() as $p) {
+        foreach (Permission::all() as $p) {
             list($appSlug, $componentSlug, $permission) = explode('|', $p->name);
             $component = $admin_app->getComponentBySlugs($appSlug, $componentSlug);
 
@@ -165,17 +165,20 @@ class AdminUser extends Component
 {
     public function getItems($searchValue, $filters, $page, $pageSize)
     {
-        return $this->authApp()->userQuery()
-            ->limit($pageSize)
-            ->offset(($page - 1) * $pageSize)
-            ->fetchAll('id');
+        $connection = \PFF\Container::db();
+        $userModelClass = $this->authApp()->userModel;
+        $items = \IPF_Database::queryAllObjects($connection, $userModelClass,
+            'SELECT * FROM auth_user' .
+            ' ORDER BY username' .
+            ' LIMIT ' . $pageSize .
+            ' OFFSET ' . (($page - 1) * $pageSize)
+        );
+        return array_column($items, null, 'id');
     }
 
     public function itemsCount($searchValue, $filters)
     {
-        return $this->authApp()->userQuery()
-            ->select(null)->select('COUNT(1)')
-            ->fetchColumn();
+        return \PFF\Container::db()->fetchColumn('SELECT COUNT(1) FROM auth_user');
     }
 
     public function list_display()
@@ -253,22 +256,20 @@ class AdminUser extends Component
 
         if ($this->authApp()->arePermissionsEnabled()) {
             Permission::revokeAll($user);
-            $permissions = Permission::query()->where('id', $form->cleaned_data['permissions'])->fetchAll();
+            $permissions = Permission::findAll($form->cleaned_data['permissions']);
             Permission::grantAll($permissions, $user);
 
             Role::leaveAll($user);
-            foreach (Role::query()->where('id', $form->cleaned_data['roles']) as $role)
+            foreach (Role::findAll($form->cleaned_data['roles']) as $role) {
                 $role->join($user);
+            }
         }
         return array($user->id, $user);
     }
 
     public function deleteObject($user)
     {
-        \PFF\Container::databaseQuery()
-            ->deleteFrom('auth_user')
-            ->where('id', $user->id)
-            ->execute();
+        \PFF\Container::db()->delete('auth_user', ['id' => $user->id]);
     }
 
     protected function objectTools($user)
@@ -310,17 +311,18 @@ class AdminRole extends Component
 {
     public function getItems($searchValue, $filters, $page, $pageSize)
     {
-        return Role::query()
-            ->limit($pageSize)
-            ->offset(($page - 1) * $pageSize)
-            ->fetchAll('id');
+        $items = Role::queryAll('SELECT * FROM auth_role' .
+            ' ORDER BY name' .
+            ' LIMIT ' . $pageSize .
+            ' OFFSET ' . (($page - 1) * $pageSize)
+        );
+        return array_column($items, null, 'id');
     }
 
     public function itemsCount($searchValue, $filters)
     {
-        return Role::query()
-            ->select(null)->select('COUNT(1)')
-            ->fetchColumn();
+        $connection = \PFF\Container::db();
+        return $connection->fetchColumn('SELECT COUNT(1) FROM auth_role');
     }
 
     public function list_display()
@@ -344,7 +346,7 @@ class AdminRole extends Component
 
     public function getObjectByID($id)
     {
-        return Role::query()->where('id', $id)->fetch();
+        return Role::queryOne('SELECT * FROM auth_role WHERE id = ?', [$id]);
     }
 
     protected function _getForm($role, $data)
@@ -373,7 +375,7 @@ class AdminRole extends Component
         $role->save();
 
         Permission::revokeAll($role);
-        $permissions = Permission::query()->where('id', $form->cleaned_data['permissions'])->fetchAll();
+        $permissions = Permission::findAll($form->cleaned_data['permissions']);
         Permission::grantAll($permissions, $role);
 
         return array($role->id, $role);
@@ -381,10 +383,7 @@ class AdminRole extends Component
 
     public function deleteObject($role)
     {
-        \PFF\Container::databaseQuery()
-            ->deleteFrom('auth_role')
-            ->where('id', $role->id)
-            ->execute();
+        \PFF\Container::db()->delete('auth_role', ['id' => $role->id]);
     }
 
     public function page_title()   { return __('Role'); }
index 258f69afd13c1cd5138111c26218658b41a3bad9..15190507e86e7b063e6ce28de4f137112e128a11 100644 (file)
@@ -14,22 +14,16 @@ class IPF_Auth_App extends IPF_Application
         return __('User Accounts');
     }
 
-    function userQuery()
-    {
-        return \PFF\Container::databaseQuery()
-            ->from('auth_user')
-            ->orderBy('username')
-            ->asObject($this->userModel);
-    }
-
     function findUser($id)
     {
-        return $this->userQuery()->where('id', $id)->fetch();
+        $connection = \PFF\Container::db();
+        return \IPF_Database::queryOneObject($connection, $this->userModel, 'SELECT * FROM auth_user WHERE id = ?', [$id]);
     }
 
     function findUserByUsername($username)
     {
-        return $this->userQuery()->where('username', $username)->fetch();
+        $connection = \PFF\Container::db();
+        return \IPF_Database::queryOneObject($connection, $this->userModel, 'SELECT * FROM auth_user WHERE username = ?', [$username]);
     }
 
     function createUser()
@@ -59,11 +53,7 @@ class IPF_Auth_App extends IPF_Application
     function arePermissionsEnabled()
     {
         if ($this->permissionsEnabled === null) {
-            $this->permissionsEnabled = (bool)\PFF\Container::databaseQuery()
-                ->from('auth_permission')
-                ->select(null)
-                ->select('COUNT(1)')
-                ->fetchColumn();
+            $this->permissionsEnabled = (bool)\PFF\Container::db()->fetchColumn('SELECT COUNT(1) FROM auth_permission');
         }
         return $this->permissionsEnabled;
     }
@@ -75,4 +65,3 @@ class IPF_Auth_App extends IPF_Application
         );
     }
 }
-
index 4346e35532e2facd7d2f8ff9f7333347eca0d908..378ff8d767bd04dc9a7d1cc70bf27a304dd5ad65 100644 (file)
@@ -7,6 +7,18 @@ abstract class DBObject
     public $id;
     protected $table = 'specify table name here';
 
+    public static function queryOne($sql, $params = [], $types = [])
+    {
+        $connection = \PFF\Container::db();
+        return \IPF_Database::queryOneObject($connection, static::class, $sql, $params, $types);
+    }
+
+    public static function queryAll($sql, $params = [], $types = [])
+    {
+        $connection = \PFF\Container::db();
+        return \IPF_Database::queryAllObjects($connection, static::class, $sql, $params, $types);
+    }
+
     public function save()
     {
         $r = new \ReflectionObject($this);
@@ -16,17 +28,19 @@ abstract class DBObject
             $name = $p->getName();
             if ($name === 'id' || $name[0] === '_')
                 continue;
-            $values[$name] = $p->getValue($this);
+            $value = $p->getValue($this);
+            if (is_bool($value)) {
+                $value = (int) $value; // DBAL workaround
+            }
+            $values[$name] = $value;
         }
 
+        $connection = \PFF\Container::db();
         if ($this->id) {
-            \PFF\Container::databaseQuery()
-                ->update($this->table, $values, $this->id)
-                ->execute();
+            $connection->update($this->table, $values, ['id' => $this->id]);
         } else {
-            $this->id = \PFF\Container::databaseQuery()
-                ->insertInto($this->table, $values)
-                ->execute();
+            $connection->insert($this->table, $values);
+            $this->id = $connection->lastInsertId();
         }
     }
 }
@@ -89,32 +103,39 @@ class User extends DBObject
 
     public function permissions()
     {
-        return Permission::query()
-            ->innerJoin('auth_user_permission ON permission_id = id')
-            ->where('user_id', $this->id)
-            ->fetchAll();
+        return Permission::queryAll('SELECT auth_permission.* FROM auth_permission ' .
+            ' INNER JOIN auth_user_permission ON permission_id = id ' .
+            ' WHERE user_id = ? ' .
+            ' ORDER BY name',
+            [$this->id]
+        );
     }
 
     public function roles()
     {
-        return Role::query()
-            ->innerJoin('auth_user_role ON role_id = id')
-            ->where('user_id', $this->id)
-            ->fetchAll();
+        return Role::queryAll('SELECT auth_role.* FROM auth_role ' .
+            ' INNER JOIN auth_user_role ON role_id = id ' .
+            ' WHERE user_id = ? ' .
+            ' ORDER BY name',
+            [$this->id]
+        );
     }
 
     public function effectivePermissions()
     {
-        return Permission::query()
-            ->where(
-              'EXISTS(SELECT 1 FROM auth_user_permission AS up ' .
-              ' WHERE up.permission_id = auth_permission.id' .
-              '   AND up.user_id = :user_id)' .
-              ' OR '.
-              'EXISTS(SELECT 1 FROM auth_user_role AS ur, auth_role_permission AS rp'.
-              ' WHERE rp.permission_id = auth_permission.id'.
-              '   AND rp.role_id = ur.role_id' .
-              '   AND ur.user_id = :user_id)', array('user_id' => $this->id));
+        return Permission::queryAll('SELECT auth_permission.* FROM auth_permission ' .
+            'WHERE ' .
+            'EXISTS(SELECT 1 FROM auth_user_permission AS up ' .
+            ' WHERE up.permission_id = auth_permission.id' .
+            '   AND up.user_id = :user_id)' .
+            ' OR ' .
+            'EXISTS(SELECT 1 FROM auth_user_role AS ur, auth_role_permission AS rp' .
+            ' WHERE rp.permission_id = auth_permission.id' .
+            '   AND rp.role_id = ur.role_id' .
+            '   AND ur.user_id = :user_id)' .
+            ' ORDER BY name',
+            ['user_id' => $this->id]
+        );
     }
 
     public function can(/* $permission ... */)
@@ -171,45 +192,51 @@ class Role extends DBObject
         return $this->name;
     }
 
-    public static function query()
+    public static function all()
     {
-        return \PFF\Container::databaseQuery()
-            ->from('auth_role')
-            ->asObject('IPF\\Auth\\Role')
-            ->orderBy('name');
+        return static::queryAll('SELECT * FROM auth_role ORDER BY name');
+    }
+
+    public static function findAll($ids)
+    {
+        if (!$ids) {
+            return [];
+        }
+        return static::queryAll('SELECT * FROM auth_role WHERE id IN (?) ORDER BY name',
+            [$ids],
+            [\Doctrine\DBAL\Connection::PARAM_INT_ARRAY]
+        );
     }
 
     public function permissions()
     {
-        return Permission::query()
-            ->innerJoin('auth_role_permission ON permission_id = id')
-            ->where('role_id', $this->id)
-            ->fetchAll();
+        return Permission::queryAll('SELECT auth_permission.* FROM auth_permission ' .
+            ' INNER JOIN auth_role_permission ON permission_id = id ' .
+            ' WHERE role_id = ? ' .
+            ' ORDER BY name',
+            [$this->id]
+        );
     }
 
     public function join($user)
     {
-        \PFF\Container::databaseQuery()
-            ->insertInto('auth_user_role')
-            ->values(array('user_id' => $user->id, 'role_id' => $this->id))
-            ->execute();
+        \PFF\Container::db()->insert('auth_user_role', ['user_id' => $user->id, 'role_id' => $this->id]);
     }
 
     public function leave($user)
     {
-        if ($this->id)
+        if ($this->id) {
             self::leaveAll($user, $this->id);
+        }
     }
 
     public static function leaveAll($user, $only=null)
     {
         $cond = array('user_id' => $user->id);
-        if ($only)
+        if ($only) {
             $cond['role_id'] = $only;
-        \PFF\Container::databaseQuery()
-            ->deleteFrom('auth_user_role')
-            ->where($cond)
-            ->execute();
+        }
+        \PFF\Container::db()->delete('auth_user_role', $cond);
     }
 }
 
@@ -218,45 +245,58 @@ class Permission extends DBObject
     protected $table = 'auth_permission';
     public $name;
 
-    public static function query()
+    public static function all()
     {
-        return \PFF\Container::databaseQuery()
-            ->from('auth_permission')
-            ->asObject('IPF\\Auth\\Permission')
-            ->orderBy('name');
+        return static::queryAll('SELECT * FROM auth_permission ORDER BY name');
+    }
+
+    public static function findAll($ids)
+    {
+        if (!$ids) {
+            return [];
+        }
+        return static::queryAll('SELECT * FROM auth_permission WHERE id IN (?) ORDER BY name',
+            [$ids],
+            [\Doctrine\DBAL\Connection::PARAM_INT_ARRAY]
+        );
     }
 
     public function grant($obj)
     {
         list($table, $data) = self::link($obj);
         $data['permission_id'] = $this->id;
-        \PFF\Container::databaseQuery()->insertInto($table, $data)->execute();
+        \PFF\Container::db()->insert($table, $data);
     }
 
     public static function grantAll($permissions, $obj)
     {
-        if (!$permissions)
+        if (!$permissions) {
             return;
+        }
 
         list($table, $data) = self::link($obj);
-        $values = array();
-        foreach ($permissions as $p)
-            $values[] = array_merge($data, array('permission_id' => $p->id));
-        \PFF\Container::databaseQuery()->insertInto($table, $values)->execute();
+        foreach ($permissions as $p) {
+            $values = array_merge($data, array('permission_id' => $p->id));
+            \PFF\Container::db()->insert($table, $values);
+        }
     }
 
     public function revoke($obj)
     {
-        if ($this->id)
+        if ($this->id) {
             self::revokeAll($obj, $this->id);
+        }
     }
 
     public static function revokeAll($obj, $only=null)
     {
         list($table, $cond) = self::link($obj);
-        if ($only)
+        if ($only) {
             $cond['permission_id'] = $only;
-        \PFF\Container::databaseQuery()->deleteFrom($table)->where($cond)->execute();
+        }
+
+        $connection = \PFF\Container::db();
+        $connection->delete($table, $cond);
     }
 
     private static function link($obj)
@@ -270,4 +310,3 @@ class Permission extends DBObject
         }
     }
 }
-
index 2c593e138a44a45ac5fe32d060422132dc4308a0..35057a4e811b7aa2492e8a59fe37066b9eb950f7 100644 (file)
@@ -27,6 +27,25 @@ class IPF_Database
         return $conn;
     }
 
+    public static function connectDBAL($database=null)
+    {
+        if (!$database) {
+            $database = IPF::get('database');
+        }
+
+        $config = new \Doctrine\DBAL\Configuration();
+
+        $connectionParams = array(
+            'driver' => 'pdo_' . \PFF\Arr::get($database, 'driver', 'mysql'),
+            'host' => \PFF\Arr::get($database, 'host', 'localhost'),
+            'dbname' => \PFF\Arr::get($database, 'database'),
+            'user' => \PFF\Arr::get($database, 'username'),
+            'password' => \PFF\Arr::get($database, 'password'),
+        );
+
+        return \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+    }
+
     public static function makeDsnForPDO($driver, $host, $port, $database)
     {
         switch ($driver) {
@@ -58,6 +77,19 @@ class IPF_Database
                 throw new Exception('Unknown driver '.$driver);
         }
     }
+
+    public static function queryOneObject(\Doctrine\DBAL\Connection $connection, $className, $sql, $params = [], $types = [])
+    {
+        $stmt = $connection->executeQuery($sql, $params, $types);
+        $stmt->setFetchMode(\PDO::FETCH_CLASS, $className);
+        return $stmt->fetch();
+    }
+
+    public static function queryAllObjects(\Doctrine\DBAL\Connection $connection, $className, $sql, $params = [], $types = [])
+    {
+        $stmt = $connection->executeQuery($sql, $params, $types);
+        return $stmt->fetchAll(\PDO::FETCH_CLASS, $className);
+    }
 }
 
 
index e09b84bd365e896faccdb4f24ec1d3c2edcb430f..c54bb2a14aeb42b4365bcad7062edf088d4448d5 100644 (file)
@@ -55,9 +55,7 @@ final class IPF_Project
     {
         \PFF\Container::setFactory('databaseConnection', array('IPF_Database', 'connect'));
 
-        \PFF\Container::setFunction('databaseQuery', function() {
-            return new FluentPDO(\PFF\Container::databaseConnection());
-        });
+        \PFF\Container::setFunction('db', array('IPF_Database', 'connectDBAL'));
 
         if (IPF::get('debug')) {
             error_reporting(E_ALL);