In this video, I show some sample code I wrote in a fresh install of CodeIgniter and Doctrine. It’s very easy to use once you get familiar with it. This will allow you to avoid writing repetetive CRUD functionality in all of your CodeIgniter models.
Later I will post an article showing how to install Doctrine into your CodeIgniter setup.
In this video:
- First I create 2 models.
- Then I create the database tables based on these models.
- Finally I insert some data into the tables by using very simple code that doesn’t involve any database queries.
#1 by Ben on October 15th, 2009
| Quote
That screencast rocks! It should have won the competition… Only two articles in this blog, but they’re very useful. Keep up the good work!
#2 by Ben on October 15th, 2009
| Quote
Oh, and as it was asked in your previous articles’ comments, that’d be nice if you could provide the code you used in the screencast, really! That’d avoid you to explain how to install Doctrine, we’ll figure it out by ourselves
#3 by Burak on October 15th, 2009
| Quote
I will post an article about it soon.
Meanwhile, I will e-mail you the code.
#4 by Gareth Price on October 18th, 2009
| Quote
I second the code request. I really want to start using Doctrine with CI, but am sruggling to find out how to install it. Looking at your code would be a massive help!
#5 by Gareth Price on October 24th, 2009
| Quote
Hi, any update on this?
#6 by Burak on October 24th, 2009
| Quote
Here you can download the files from the screencast:
http://www.phpandstuff.com/wp-content/uploads/2009/10/ci_nettuts_screencast_competetion.zip
I installed it using codeigniter hooks.
But, now I’m trying to come up with a nicer way to install it. I’ll post an article once I have it.
#7 by begs on October 28th, 2009
| Quote
Hi there,
very nice screencast.
But i have a question:
Is it possible to run Deoctrine AND the “normal” CI Models?
Because when i install Doctrine, i get the following error when using a “normal” CI Model extending “Model”:
Fatal error: Class ‘Model’ not found in c:\xxxyyy…
When i unhook doctrine, the Model is found and everything is perfect…
#8 by Burak on October 28th, 2009
| Quote
Put this inside your hook before the Doctrine::loadModels call:
require_once BASEPATH.’/libraries/Model.php’;
#9 by FEDEX on December 19th, 2009
| Quote
great job guys, i want more screencast with more complex samples
please
cu
#10 by joe on January 10th, 2010
| Quote
Burak,
Thanks for this great piece. I have a question, if I wanted to use sqlite3 as my database with doctrine and codeigniter would it be worth it? Since sqlite works with PDO and CI doesn’t play well with pdo*. And if it is possible could just explain how? I was thinking of having a go at it but where I am from we have a saying “…you ask for directions…you won’t get missing…”?
Again thank you.
Joe
#11 by Burak on January 10th, 2010
| Quote
Not sure what you mean by “CI doesn’t play well with pdo”.
But Doctrine works on PDO, and this allows you to set your database driver pretty easily. I haven’t myself tried it yet, but I don’t see why you couldn’t just set it to use sqlite. It is listed as one of the supported database engines.
#12 by joe on January 12th, 2010
| Quote
ok good I will try sqlite and see. I would be glad if you would also try it if you can and share your wisdom with us on any GOTCHAS to it.
Much Obliged!!!
#13 by Emir on February 10th, 2010
| Quote
Hello Burak, why there is no sound?or is it me? what do I need to install to see this screencast , the topic is most interesting
#14 by Burak on February 10th, 2010
| Quote
Yes, there is sound. You shouldn’t need to install anything, it’s just a flash video.
#15 by Emir on February 11th, 2010
| Quote
Hey Burak,
I just took long time to load, my torrents were on didn’t see that. Do you have anymore scree casts or tutorials about doctrine, this was really amazing what it does, I’ve been php developer for years now and I never headr/used doctrine.
#16 by Burak on February 11th, 2010
| Quote
I don’t have any videos on Doctrine yet. I would like to start doing that eventually.
Right now I’m working on some CodeIgniter screencasts. They should be published on Nettuts.com soon.
#17 by Emir on February 11th, 2010
| Quote
I know about your codeigniter tutorials they are great. I’m following. Keep up the good work
#18 by Andrea on February 17th, 2010
| Quote
Hey man, congrats for the introductory article!
It’s been a while that i mess ’round CodeIgniter and see that you’d publish more then 10 articles on it… I start to study right now!