dev-master
9999999-dev https://github.com/HawkBitPhPDoctrine 2 ORM integration for Hawkbit PSR-7 Micro PHP framework
MIT
The Requires
The Development Requires
by Marco Bunge
orm doctrine persistence hawkbit
Wallogit.com
2017 © Pedro Peláez
Doctrine 2 ORM integration for Hawkbit PSR-7 Micro PHP framework
![Software License][ico-license]
![Total Downloads][ico-downloads]
, (*1)
Doctrine 2 ORM integration for Hawkbit PSR-7 Micro PHP framework., (*2)
Hawkbit Doctrine is available on Packagist and can be installed using Composer. This can be done by running the following command or by updating your composer.json file., (*3)
composer require hawkbit/doctrine
composer.json, (*4)
{
"require": {
"hawkbit/doctrine": "~1.0"
}
}
Be sure to also include your Composer autoload file in your project:, (*5)
<?php require __DIR__ . '/vendor/autoload.php';
This project is also available for download as a .zip file on GitHub. Visit the releases page, select the version you want, and click the "Source code (zip)" download button., (*6)
The following versions of PHP are supported by this version., (*7)
Setup with an existing application configuration (we refer to tests/assets/config.php), (*8)
<?php use \Hawkbit\Application; use \Hawkbit\Doctrine\DoctrineService; use \Hawkbit\Doctrine\DoctrineServiceProvider; $app = new Application(require_once __DIR__ . '/config.php'); $entityFactoryClass = \ContainerInteropDoctrine\EntityManagerFactory::class; $doctrineService = new DoctrineService([ DoctrineService::resolveFactoryAlias($entityFactoryClass) => [$entityFactoryClass] ], $app); $app->register(new DoctrineServiceProvider($doctrineService));
A full configuration is available on DASPRiD/container-interop-doctrine/example/full-config.php. Refer to container-interop-doctrine Documentation for further instructions on factories., (*9)
<?php
/** @var \Hawkbit\Doctrine\DoctrineServiceInterface $doctrine */
$doctrine = $app[\Hawkbit\Doctrine\DoctrineServiceInterface::class];
$em = $doctrine->getEntityManager();
// or with from specific connection
$em = $doctrine->getEntityManager('connectionname');
Access doctrine service in controller. Hawbit is inject classes to controllers by default., (*10)
<?php
use \Hawkbit\Doctrine\DoctrineServiceInterface;
class MyController{
/**
* @var \Hawkbit\Doctrine\DoctrineServiceInterface
*/
private $doctrine = null;
public function __construct(DoctrineServiceInterface $doctrine){
$this->doctrine = $doctrine;
}
public function index(){
$em = $this->doctrine->getEntityManager();
// or with from specific connection
$em = $this->doctrine->getEntityManager('connectionname');
}
}
Please see CHANGELOG for more information what has changed recently., (*11)
bash
$ composer test, (*12)
Please see CONTRIBUTING for details., (*13)
If you discover any security related issues, please email mjls@web.de instead of using the issue tracker., (*14)
The MIT License (MIT). Please see License File for more information., (*15)
Doctrine 2 ORM integration for Hawkbit PSR-7 Micro PHP framework
MIT
orm doctrine persistence hawkbit