This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
init.php
51 lines (43 loc) · 1.93 KB
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* kohana-doctrine initialization, executed by application bootstrap.php
*
* LICENSE: THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
* CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED
* BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
* AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
*
* BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO
* BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE
* CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE
* IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
*
* @category module
* @package kohana-doctrine
* @author gimpe <[email protected]>
* @copyright 2011 International Jaywalkers
* @license http://creativecommons.org/licenses/by/3.0/ CC BY 3.0
* @link http://github.com/gimpe/kohana-doctrine
*/
// include kohana-doctrine config
$doctrine_config = Kohana::config('doctrine');
// include Doctrine ClassLoader.php
include $doctrine_config['doctrine_path'] . 'Doctrine/Common/ClassLoader.php';
// defines Doctrine namespace
$classLoader = new \Doctrine\Common\ClassLoader(
'Doctrine', $doctrine_config['doctrine_path']);
$classLoader->register();
// defines Symfony namespace
$classLoader = new \Doctrine\Common\ClassLoader(
'Symfony', $doctrine_config['doctrine_path'] . '/Doctrine');
$classLoader->register();
// defines your "entitites" namespace
$classLoader = new \Doctrine\Common\ClassLoader(
$doctrine_config['entities_namespace'], $doctrine_config['entities_path']);
$classLoader->register();
// defines your "proxies" namespace
$classLoader = new \Doctrine\Common\ClassLoader(
$doctrine_config['proxies_namespace'], $doctrine_config['proxies_path']);
$classLoader->register();
// re-use already loaded Doctrine config
Doctrine_ORM::set_config($doctrine_config);