Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2 and Doctrine 2
#1

[eluser]Rui Lima[/eluser]
Any good way to do this with a non-intrusive approach?

I'm not able to find any tutorial with the version 2 of both api.
#2

[eluser]Rui Lima[/eluser]
I've found this:
http://www.doctrine-project.org/projects...odeigniter

but got lost on:
"Put the Doctrine folder (the one that contains Common, DBAL, and ORM) inside that same
libraries folder."

there is no folder that contains Common, DBAL and ORM Sad
#3

[eluser]Rui Lima[/eluser]
I'm almost there... Big Grin
#4

[eluser]JiPi[/eluser]
Is CI2 usable yet ? What stage of development is it currently ? We hadn't any news (on frontpage I mean) since the march...
#5

[eluser]Rui Lima[/eluser]
Yes!
see here: http://ellislab.com/forums/viewreply/770721/

By the way, i think i've got it working CI2 + Doctrine 2, using a library as approach.
Even have the CLI working.
I'll post here HOW TO when i've some time. maybe in weekend.
#6

[eluser]Deyan Yankov[/eluser]
[quote author="Rui Lima" date="1278621520"]Yes!
see here: http://ellislab.com/forums/viewreply/770721/

By the way, i think i've got it working CI2 + Doctrine 2, using a library as approach.
Even have the CLI working.
I'll post here HOW TO when i've some time. maybe in weekend.[/quote]

Hello! Could you please post your Doctrine.php (the library configuration) file? I am banging my head ofr 3 days already to get Doctrine 2 working and nothing but headache (maybe also because of the death metal i'm listening too Smile) ) Thank you very very much! There's no other info on the net ... Sad
#7

[eluser]Rui Lima[/eluser]
Hello, sorry! i've been a little sick this days.
I will post the how to ASAP.
#8

[eluser]Rui Lima[/eluser]
first of all, sorry not being able to post this sooner.
How to integrate CodeIgniter 2 and Doctrine 2
Here is my final folder structure:
please see attachement 1.png

You should take careful look at libraries and models.
Inside libraries I have a Library called Doctrine.php and have 2 folders one to CLI and other to “Web”.
Then inside models I have a folder called Entities. I want to have my own models, but this one will not access directly to DB, for them the DB are the Entities.

In codeigniter what sould be done?!
Code:
$autoload['libraries'] = array('doctrine');

then confirm that inside DoctrineCLI\cli-config.php the database connection is the same as the codeigniter database.php.
and that's all.
i attach my files.
i'm using xampp for windows, so hope you don't have any problems.
i'm not a expert, but any problem/observation post it here.

please get my forlder structure at:
http://1e4411af.realfiles.net
you will need 7ZIP
#9

[eluser]subbu.genie[/eluser]
Hey,

First of all thanks a lot for the post. I tried something similar except that I dont have a CLI. The other thing to be noted is that Doctrine2 depends and works a lot on Namespaces which have come in PHP5.3. So while creating a model or referencing the same quoting them against their namespaces is very much required for Doctrine2. I would soon post a zip file of something I have done.

Subbu
#10

[eluser]Prophet[/eluser]
Hi everyone. I've been trying to implement D2 with CI2 for the last few days. I'm still wrapping my head around the Doctrine ClassLoaders and PHP namespaces but I think I understand them well enough now.

Here's a bit of what I've learned, just in case it helps somebody else.

If you followed the Doctrine documentation when you set up your bootstrap file (application/libraries/Doctrine.php), you may have noticed the line:
Code:
$entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, '/' ));

This tells Doctrine's ClassLoader to look in application/ (or so I thought) whenever you request a class from the models namespace. The thing that took me a while to work out is that it actually looks in application/models.

So if you would like to create a User class, you need to create application/models/User.php and have it look something like this:
Code:
namespace models;

class User
{
    private $id;
    private $username;
    private $password;
}

You can then do something like $user = new models\User;

I hope this helps somebody, because it took me a while to work out how to load classes like this. This way seems a bit more complicated then Doctrine 1.2 so maybe I'm not doing it properly? If that's the case, could somebody point me in the right direction Smile




Theme © iAndrew 2016 - Forum software by © MyBB