PHP code example of gollumsf / doctrine-type

1. Go to this page and download the library: Download gollumsf/doctrine-type 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/ */

    

gollumsf / doctrine-type example snippets


namespace App\Doctrine;

use GollumSF\Doctrine;
use App\Entity\MyEnum as Enum;

class MyEnum extends EnumType {
	
	public function getEnum(): string {
		return Enum::class;
	}
}

namespace App\Entity;

use GollumSF\Enum\Enum;
use Doctrine\ORM\Mapping as ORM;

class MyEnum extends Enum {
	const VALUE1 = 'VALUE1';
	const VALUE2 = 'VALUE2';
	const VALUE3 = 'VALUE3';
}

/**
 * @ORM\Table()
 */
class Entity {
	
	/**
	 * @ORM\Column(type="tinyint")
	 * @var int
	 */
	private $tinyint;
	
	/**
	 * @ORM\Column(type="array_pipe")
	 * @var int
	 */
	private $arrayPipe = [
		'ROLE_EXAMPLE', 'ROLE_USER', 'ROLE_ADMIN'
	];
	// Storage data in database with value: ROLE_EXAMPLE|ROLE_USER|ROLE_ADMIN
	
	/**
	 * @ORM\Column(type="enum_my_enum")
	 * @var int
	 */
	private $enum;
	
	/////////
	// ... //
	/////////
	
}