1. Go to this page and download the library: Download dxi/doctrine-extension 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/ */
dxi / doctrine-extension example snippets
class MyEnum extends \MabeEnum\Enum
{
const ONE = 'one';
const TWO = 'two';
}
class MyEntity
{
private $id;
/**
* @var MyEnum
*/
private $myEnum;
/**
* @return MyEnum
*/
public function getMyEnum()
{
return $this->myEnum;
}
/**
* @param MyEnum $myEnum
*/
public function setMyEnum(MyEnum $myEnum)
{
$this->myEnum = $myEnum;
}
public function getId()
{
return $this->id;
}
}
use Dxi\DoctrineExtension\Enum\DBAL\DBALTypeRegistrar;
use Dxi\DoctrineExtension\Enum\DBAL\DBALTypeClassGenerator;
$targetDir = './enum-db-types';
$typeNamespace = 'My\Enum\DBALTypes';
$registrar = new DBALTypeRegistrar(new DBALTypeClassGenerator($targetDir, $typeNamespace));
$registrar->registerType('my_enum_type', '\MyEnum');
use Dxi\DoctrineExtension\Enum\DBAL\DBALTypeRegistrar;
use Dxi\DoctrineExtension\Enum\DBAL\DBALTypeClassGenerator;
$targetDir = './enum-mongo-types';
$typeNamespace = 'My\Enum\MongoDbTypes';
$registrar = new MongoDbTypeRegistrar(new MongoDbTypeClassRegistrar($targetDir, $typeNamespace));
$registrar->registerType('my_enum_type', '\MyEnum');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.