mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
...
parent
6d1a5466db
commit
f00a60a3de
@ -46,6 +46,8 @@ class MY_Loader extends CI_Loader {
|
||||
Then, once you have a `MY_Loader.php` add the `doctrine()` method to the `MY_Loader` class. After you're done it should resemble the following:
|
||||
|
||||
[code]
|
||||
<?php
|
||||
|
||||
class MY_Loader extends CI_Loader {
|
||||
function doctrine($table=FALSE) {
|
||||
$ci =&get;_instance();
|
||||
@ -75,6 +77,8 @@ class MY_Loader extends CI_Loader {
|
||||
Now that Doctrine is installed you'll have to set up your database tables and models manually. You can read the documentation to use the command line to automatically create things via YML, but in effect you'll need something like the following in your model (you should be able to guess the MySQL table based on the hasColumn calls):
|
||||
|
||||
[code]
|
||||
<?php
|
||||
|
||||
class Song extends Doctrine_Record {
|
||||
public function setTableDefinition() {
|
||||
$this->setTableName('library');
|
||||
@ -92,6 +96,8 @@ class Song extends Doctrine_Record {
|
||||
With that set up you can use Song in your controller something like this:
|
||||
|
||||
[code]
|
||||
<?php
|
||||
|
||||
class Welcome extends Controller {
|
||||
function index() {
|
||||
$this->load->doctrine('song');
|
||||
|
Loading…
x
Reference in New Issue
Block a user