1. Go to this page and download the library: Download lamansky/doctrine library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lamansky / doctrine example snippets
namespace MyProject\Doctrine;
use Lamansky\Doctrine\ProjectEntityManager;
class EntityManager extends ProjectEntityManager {
protected function getEntityNamespacePrefix () : string {
return 'MyProject\Model\Entity\\';
}
protected function getProxyNamespacePrefix () : string {
return 'MyProject\Model\Proxy\\';
}
}
use MyProject\Doctrine\EntityManager;
global $em;
$em = new EntityManager(
DB_HOST,
DB_USER,
DB_PASS,
DB_NAME,
IS_DEV_ENV, // This should be true or false.
__DIR__ . '/Model/Entity', // This is the path to your Entity class files directory.
__DIR__ . '/Model/Proxy' // This is the directory path in which generated Proxy class files should be stored.
);
use Doctrine\DBAL\Types\Type;
Type::overrideType('datetime', 'Lamansky\Doctrine\UTCDateTimeType');
Type::overrideType('datetimetz', 'Lamansky\Doctrine\UTCDateTimeType');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.