I am working to make a batch file which will get some data from DB and send email. A folder Batch is created in the same level of app and web. Now my question is - how to access DB and other controls out of controller.
I tried to import
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; but it gives error saying no such files found.
I don;t want it to be command/console app.
My aim is to create a file which uses symfony components and Doctrine by staying outside bundle/controller. How do I import files in the file?.
First I really recommend to create a Symfony Console Command for this.
But if you really want to create a file (lets say
test.php) in your document root, you can load a symfony service like this:PS: In there you should also be able to make use of all other symfony components.
PPS: The
Notice: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMM IT_ON_SUCCESS'error tells you that something is wrong with youroci8extension try to reinstall/install or enable it again. http://php.net/manual/en/oci8.installation.php