apioo / psx

PSX is an innovative PHP framework dedicated to build fully typed REST APIs.
https://phpsx.org
Apache License 2.0
170 stars 13 forks source link

Database support? #16

Closed mmuruev closed 8 years ago

mmuruev commented 8 years ago

It's mostly question. PHP framework without any trace DB support? Others 'miro' does provide something like providers. So how to handle this here?

chriskapp commented 8 years ago

Hi, by default we provide a Doctrine DBAL connection which you can use in your controller through the Inject annotation i.e.:

class FooController extends ControllerAbstract
{
    /**
     * @Inject
     * @var \Doctrine\DBAL\Connection
     */
    protected $connection;
}

The DB credentials must be defined in the configuration.php file. If you want to use another DB library you need to add the library to the DI container. Please check the DI chapter (http://psx.readthedocs.org/en/latest/design/dependency_injection.html) of the manual to see howto add/use a service.

mmuruev commented 8 years ago

Sounds good enough. No ORM suppost from Doctrine I suppose.