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
Home
gimpe edited this page Jun 26, 2011
·
17 revisions
Kohana 3.1 module to integrate Doctrine ORM 2.0.6.
First version.
Todo
- make Doctrine cache configurable by enviroment
- add Kohana profiling
My directory structure
.
├── application
│ ├── cache
│ ├── classes
│ │ ├── controller
│ │ ├── Entities
│ │ ├── model
│ │ └── Proxies
│ ├── config
│ ├── i18n
│ ├── logs
│ ├── mappings
│ │ └── yml
│ ├── messages
│ └── views
├── modules
│ └── kohana-doctrine
│ ├── bin
│ ├── classes
│ │ ├── console
│ │ └── doctrine
│ ├── config
│ └── vendor
│ └── doctrine-orm
└── system
Enable it:
<?php
// [...]
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(
array(
'database' => SYSPATH . '../modules/database',
'kohana-doctrine' => MODPATH . 'kohana-doctrine',
)
);
// [...]
Use it:
<?php
class Controller_Welcome extends Controller
{
public function action_index()
{
$doctrine_orm = new Doctrine_ORM;
$entityManager = $doctrine_orm->get_entity_manager();
// [...]
}
}
CLI:
# SELECT from default database
prompt$ php modules/kohana-doctrine/bin/doctrine dbal:run-sql 'SELECT NOW()'
array(1) {
[0]=>
array(1) {
["NOW()"]=>
string(19) "2011-03-12 21:20:18"
}
}
# SELECT from sessions database
prompt$ modules/kohana-doctrine/bin/doctrine dbal:run-sql --database-group=session 'SELECT * FROM sessions'