dev-master
9999999-devDoctrine DBAL Helper Bundle. Providing extra functionality for the DBAL
MIT
The Requires
- php >=5.3.3
- doctrine/dbal >=2.1
- symfony/framework-bundle ~2.0
by Sebastiaan Stok
bundle doctrine symfony dbal
Wallogit.com
2017 © Pedro Peláez
Doctrine DBAL Helper Bundle. Providing extra functionality for the DBAL
This listener listens to DBAL related Exceptions and looks for an so-called user-error., (*1)
Currently only PostgreSQL is supported., (*2)
An user-error is an exception/error thrown by an DB used-defined function, and can be seen as a system exception, so its not intended for validating basic user-input., (*3)
Usage may include an access-violation or none-existent relation., (*4)
To install RollerworksDBBundle with Composer add the following to your
composer.json file:, (*5)
// composer.json
{
// ...
require: {
// ...
"rollerworks/db-bundle": "master-dev"
}
}
NOTE: Please replace master-dev in the snippet above with the latest stable
branch, for example 1.0.*., (*6)
Then, you can install the new dependencies by running Composer's update
command from the directory where your composer.json file is located:, (*7)
$ php composer.phar update
Now, Composer will automatically download all required files, and install them
for you. All that is left to do is to update your AppKernel.php file, and
register the new bundle:, (*8)
<?php
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Rollerworks\Bundle\DBBundle\RollerworksDBBundle(),
// ...
);
deps file (Symfony 2.0.x)First, checkout a copy of the code. Just add the following to the deps
file of your Symfony Standard Distribution:, (*9)
[RollerworksDBBundle]
git=http://github.com/rollerworks/RollerworksDBBundle.git
target=/bundles/Rollerworks/Bundle/DBBundle
NOTE: You can add version tag in the snippet above with the latest stable
branch, for example version=origin/2.0., (*10)
Then register the bundle with your kernel:, (*11)
<?php
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Rollerworks\Bundle\DBBundle\RollerworksDBBundle(),
// ...
);
Make sure that you also register the namespace with the autoloader:, (*12)
<?php
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Rollerworks' => __DIR__.'/../vendor/bundles',
// ...
));
Now use the vendors script to clone the newly added repositories
into your project:, (*13)
$ php bin/vendors install
If you're managing your vendor libraries with submodules, first create the
vendor/bundles/Rollerworks/Bundle directory:, (*14)
``` bash $ mkdir -pv vendor/bundles/Rollerworks/Bundle, (*15)
Next, add the necessary submodule: ``` bash $ git submodule add git://github.com/rollerworks/RollerworksDBBundle.git vendor/bundles/Rollerworks/Bundle/DBBundle
Add the following entry to your autoloader:, (*16)
``` php <?php // app/autoload.php, (*17)
$loader->registerNamespaces(array( // ... 'Rollerworks' => DIR.'/../vendor/bundles', // ... ));, (*18)
### Step3: Enable the bundle Finally, enable the bundle in the kernel: ``` php <?php // in AppKernel::registerBundles() $bundles = array( // ... new Rollerworks\Bundle\DBBundle\RollerworksDBBundle(), // ... );
Congratulations! You're ready!, (*19)
By default the exception listerner only listens to \PDOException and \Doctrine\DBAL\Driver\OCI8\OCI8Exception. And only tries to parse the error message when its starts with 'app-exception: '., (*20)
You may change this by adding this to your configuration., (*21)
``` yaml, (*22)
rollerworks_db: user_exception_listener: check_prefix: 'my-app-exception: ' check_class_in: [ '\PDOException' ] ```, (*23)
Doctrine DBAL Helper Bundle. Providing extra functionality for the DBAL
MIT
bundle doctrine symfony dbal