Download the PHP package hostnet/hn-dependency-injection-plugin without Composer
On this page you can find all versions of the php package hostnet/hn-dependency-injection-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hostnet/hn-dependency-injection-plugin
More information about hostnet/hn-dependency-injection-plugin
Files in hostnet/hn-dependency-injection-plugin
Package hn-dependency-injection-plugin
Short Description Introduces the Symfony DI container in a Symfony 1 application.
License MIT
Informations about the package hn-dependency-injection-plugin
hnDependencyInjectionPlugin
- Introduces the Symfony 2 DI container in a Symfony 1 application.
- Transforms a Symfony 2 doctrine configuration into a format readable for Symfony 1.x. Use Doctrine entities and propel classes with the same database configuration!
Installation
- Download Composer.
- Run
- Make extend .
-
[Optional] override the method to return your own kernel, registering the bundles you want.
- Create to configure your Doctrine dbal, Doctrine orm, and possibly the FrameworkBundle. See also the example configuration.
-
If you don't want to generate the propel backwards compatability layer, add this
to , or if you prefer to have them separate.
-
To ensure proper autoloading when using Doctrine entities, remove if you have
and add the following to your .
That way Doctrine knows where to find your entities.
- Be sure to set up your permissions properly, see "Setting up your permissions".
- After this is done we can do a little cleanup. To prevent confusion you should remove , since only the Symfony 2 configuration is read at this point.
Changelog
2.0.0
- Removed the Symfony1Panel class, it's added automatically now.
1.1.0
- Added a web debug panel with a link to the Symfony 2 profiler.
For this you need to activate the WebProfilerBundle, which you should only activate in dev
Then you need to configure the WebProfilerBundle and the profiler; add this to your config_dev.yml:
Add this to to make the WebProfilerBundle accessible:
And in web/*.php, replace with:
You should now have a new panel in the Symfony 1 web debug toolbar with a link to the Symfony 2 profiler!
1.0.0
- First official release
0.15
- Added parameter
Running the unit-tests
- Clone the repository yourself
- Go to the directory of the clone
- Run
- Run
Moving the error handling to Symfony 2
When migrating, you will eventually hit a point where you want to log
errors properly. By default the sfFrontWebController
contains a try
catch block where exceptions will be caught. In order to move all error
handling to Symfony 2, you can create your own front controller. If you
remove the try catch in this front controller, all errors will
be caught by the Symfony 2 uncaught exception handler.
If your route is matched with the sf1 route but sf1 doesn't know about the
route, it will throw an sf404ErrorException
. This exception will be caught
and wrapped into an HttpNotFoundException
and the kernel.exception
will
be fired eventually. This will make sure you can handle all exceptions in
Symfony 2.
Additionally, you can throw exceptions in sf1 such as AccessDeniedException
,
NotFoundHttpException
, \RuntimeException
etc. They will all be caught. In
case of a 404 error, the sf1 fallback will only be triggered once and can only
be triggered as a first controller. Once you've succesfully entered Symfony 2
via either the sf1 route or the normal entry, it will no longer be initiated.
To add the front controller, you will have to set it in factories.yml
.
To enable the Symfony2 404 handling, you will have to set the following parameter to true:
All versions of hn-dependency-injection-plugin with dependencies
doctrine/dbal Version ^2.13.4||^3.1.1
doctrine/doctrine-bundle Version >=1.7.0
doctrine/orm Version >=2.6
symfony/symfony Version ^4.4||^5.0
symfony/symfony1 Version ~1.1.27