PHP code example of ingenerator / kohana-doctrine2

1. Go to this page and download the library: Download ingenerator/kohana-doctrine2 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/ */

    

ingenerator / kohana-doctrine2 example snippets



// application/config/database.php
return [
    'default' => [
        // 'type' => 'MySQL' (this is the default AND we'll throw an exception if you use anything else)
        'connection' => [
            'hostname' => 'localhost',
            'database' => 'mydatabase',
            'username' => 'me',
            'password' => 'sesame',
        ],
        // 'charset'         => 'utf8' (this is the default if not specified)
        // 'timeout_seconds' => 5 (this is the default if not specified)
    ]
];


// application/config/doctrine.php
return [
    'entity_classes' => [
        \My\Amazing\Entity::class,
        \My\Other\Entity::class,
        \Third\Party\Entity::class,
    ],
    'orm' => [
        // 'auto_gen_proxies' => FALSE, (defaults to TRUE in development, FALSE otherwise)
        // 'proxy_dir         => APPPATH.'/DoctrineEntityProxy',
        // 'proxy_namespace'  => 'DoctrineEntityProxy',
        'custom_types' => [
            // Any custom column types that should be registered when Doctrine is loaded
            'money' => \My\Money\Type::class,
        ]        
    ]
];


// application/config/dependencies.php
return [
    '_ory::definitions(),
    ],
    // Any of your own definitions and overrides
];


// application/config/dependencies.php
return [
    '_ory::definitions(),
        \Ingenerator\KohanaDoctrine\Dependency\DoctrineFactory::subscriberDefinitions([
            \My\Subscriber::class => ['arguments' => ['%some.service.it.needs%']],
            \My\Other\Subscriber::class => ['arguments' => ['@some.config@']],
        ]),
    ],
    // Any of your own definitions and overrides
];


// cli-config.php
use Doctrine\ORM\Tools\Console\ConsoleRunner;

error_reporting(E_ALL);
ini_set('display_errors', 1);