PHP code example of bit3 / contao-doctrine-orm

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

    

bit3 / contao-doctrine-orm example snippets


$GLOBALS['DOCTRINE_ENTITIES'][] = 'orm_my_entity_type';

$GLOBALS['DOCTRINE_ENTITY_NAMESPACE_MAP']['orm_my_entity'] = 'My\Entity';

$GLOBALS['DOCTRINE_ENTITY_NAMESPACE_ALIAS']['My'] = 'My\Entity';



$GLOBALS['TL_DCA']['...'] = array(
	'entity' => array(
		// (optional) Repository class name
		'repositoryClass' => 'MyEntityRepositoryClassName',

		// (optional) ID generator type
		'idGenerator' => \Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_UUID,

		// (optional) Index definition
		'indexes' => array(
			'idx_name' => array('column_one', 'column_two', '...'),
		),

		// (optional) Unique constraints
		'uniques' => array(
			'unique_name' => array('column_one', 'column_two', '...'),
		),
	),
	'fields' => array(
		'...' => array(
			'field' => array(
				'type' => (string),
				// do not set fieldName!
				'
			),
		),
	),
);