In this tutorial we will be looking into Doctrine Record Hooks. This will allow us to trigger certain actions in our Models.
We are going to use this feature to simplify a few things in the existing code, and even gain some performance benefits.
"CodeIgniter and Doctrine from Scratch" Series:
Record Hooks
In the Day 8 article we talked about CodeIgniter Hooks. This time we are going to look at Record Hooks with Doctrine.
Hooks are used to execute certain code when a certain event is triggered. Record Hooks are used when something happens with a Doctrine Record. For example we can use the postInsert hook to do some task every time a new record is inserted.
Here is a list of all available Record Hooks:
- preSave
- postSave
- preUpdate
- postUpdate
- preInsert
- postInsert
- preDelete
- postDelete
- preValidate
- postValidate
To use a one of these hooks, simply add a method with that name into the Doctrine_Record model:
class Post extends Doctrine_Record {
public function setTableDefinition() {
// ...
}
public function setUp() {
// ...
}
public function postInsert() {
// a new record was inserted
// you can put some code here
}
}
Let’s look at what we are going to be doing today to utilize this feature.
Forum Display Page Improvements
In the Day 9 article we built a page for displaying all Threads under a Forum.

Let’s look at the code we used for getting the list of threads:
// from the Forum model
// ...
public function getThreadsArray($offset, $limit) {
$threads = Doctrine_Query::create()
->select('t.title')
->addSelect('p.id, (COUNT(p.id) - 1) as num_replies')
->addSelect('MIN(p.id) as first_post_id')
->addSelect('MAX(p.created_at) as last_post_date')
->from('Thread t, t.Posts p')
->where('t.forum_id = ?', $this->id)
->groupBy('t.id')
->orderBy('last_post_date DESC')
->limit($limit)
->offset($offset)
->setHydrationMode(Doctrine::HYDRATE_ARRAY)
->execute();
foreach ($threads as &$thread) {
$post = Doctrine_Query::create()
->select('p.created_at, u.username')
->from('Post p, p.User u')
->where('p.id = ?', $thread['Posts'][0]['first_post_id'])
->setHydrationMode(Doctrine::HYDRATE_ARRAY)
->fetchOne();
$thread['num_replies'] = $thread['Posts'][0]['num_replies'];
$thread['created_at'] = $post['created_at'];
$thread['username'] = $post['User']['username'];
$thread['user_id'] = $post['User']['id'];
unset($thread['Posts']);
}
return $threads;
}
// ...
There are two main DQL queries. The first one for fetching the Threads, and the second one, inside of a loop, for fetching further details about each Thread, such as number of replies, the username etc…
There is quite a bit going on in there. With the changes we will make today, we will be able to reduce that into a single DQL call.
Adding a “First_Post” Relationship
We first had to get the id of the first post, and then get information on that post in another DQL query. If we had a direct relationship with a “First_Post” record, it would simplify things.
- Edit: system/application/models/thread.php
<?php
class Thread extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('title', 'string', 255);
$this->hasColumn('forum_id', 'integer', 4);
$this->hasColumn('first_post_id', 'integer', 4);
}
public function setUp() {
$this->hasOne('Forum', array(
'local' => 'forum_id',
'foreign' => 'id'
));
$this->hasMany('Post as Posts', array(
'local' => 'id',
'foreign' => 'thread_id'
));
$this->hasOne('Post as First_Post', array(
'local' => 'first_post_id',
'foreign' => 'id'
));
}
}
The highlighted lines have been added. Now each Thread will have a relationship with a Post record, which will be the first Post in that Thread.
Setting up the Hook
When a new Post is added, if it is the first Post in that Thread, it needs to be assigned to the First_Post relationship. This will be done with the following “postInsert” Record Hook.
- Edit: system/application/models/post.php
<?php
class Post extends Doctrine_Record {
// ...
public function postInsert() {
// is this the first post?
if (!$this['Thread']['First_Post']->exists()) {
$this['Thread']['First_Post'] = $this;
$this['Thread']->save();
}
}
}
Note that “postInsert” means, “after” insert. It has nothing to do with the class name “Post”.
This function gets invoked right after a new Post record was created.
First we check if a First_Post relationship exists, with the exist() function. If not, we assign “$this”, which is the current Post record, to this relationship with the corresponding Thread record.
Rebuild the Database
- Drop all tables.
You may use this query:
SET FOREIGN_KEY_CHECKS = 0; DROP TABLE category, forum, post, thread, user;
Now we need to rebuild it all.
- Go to: http://localhost/ci_doctrine/doctrine_tools/create_tables and click the button.
- Go to: http://localhost/ci_doctrine/doctrine_tools/load_fixtures and click the button.
Now all the tables are rebuilt and the fixture data is reloaded.
Take a look at your thread table:

You can see the new column. And thanks to the Record Hook, the values have been assigned already.
Simplify Things
Now we can go ahead and simplify the “getThreadsArray” method under the Forum Model.
- Edit: system/application/models/forum.php
<?php
class Forum extends Doctrine_Record {
// ...
public function getThreadsArray($offset, $limit) {
$threads = Doctrine_Query::create()
->select('t.title')
->addSelect('p.id, (COUNT(p.id) - 1) as num_replies')
->addSelect('MAX(p.created_at) as last_post_date')
->addSelect('fp.created_at, u.username')
->from('Thread t, t.Posts p, t.First_Post fp, fp.User u')
->where('t.forum_id = ?', $this->id)
->groupBy('t.id')
->orderBy('last_post_date DESC')
->limit($limit)
->offset($offset)
->setHydrationMode(Doctrine::HYDRATE_ARRAY)
->execute();
foreach ($threads as &$thread) {
$thread['num_replies'] = $thread['Posts'][0]['num_replies'];
$thread['created_at'] = $thread['First_Post']['created_at'];
$thread['username'] = $thread['First_Post']['User']['username'];
$thread['user_id'] = $thread['First_Post']['User']['id'];
unset($thread['Posts']);
}
return $threads;
}
}
Line 13: Now we have 2 more relationships in the from() call. First_Post and the User for the First_Post.
Line 12: We select the created_at and username fields from these new relationships.
Line 25,26,27: These lines have been changed to use the new fields.
Also the DQL query inside the loop is now gone. This should have a positive impact on performance.
Note that the loop now is only being used to simplify the $threads array structure, so it’s actually optional.
Testing the Results
We haven’t really changed anything on the actual pages. So everything should look the same as before.

Stay Tuned
There are many things you can do with Hooks and Listeners in Doctrine. Make sure to read the documentation.
I hope you enjoyed this tutorial. See you next time!

Pingback: Tweets that mention CodeIgniter and Doctrine from scratch. Day 11 – Record Hooks | PHP and Stuff -- Topsy.com
#1 by DynamiteN on February 8th, 2010
| Quote
loving this series, keep ‘em comming
only series it feels like im learning something
#2 by krzysko on February 9th, 2010
| Quote
Thanks Burak. Your tutorials are cool. thx thx thx
#3 by Maor on February 9th, 2010
| Quote
Amazing one! keep up the good job!
Hope to see a lot more coming!
#4 by Dani on February 9th, 2010
| Quote
Great tuto! I’m a fun of this series too.
I’m beginner in codeigniter… has it an automatic process to populate and set forms?
Thanks!
#5 by Burak on February 9th, 2010
| Quote
Here you can read about form helper functions:
http://codeigniter.com/user_guide/helpers/form_helper.html
And towards the end, you will see set_* functions. Those can be used for auto populating the form field values.
#6 by Ivan Rivera on February 9th, 2010
| Quote
Hello,
I get an error every time I try to load fixtures, and the problem is with the first_post_id, the error says that it doesn´t have a default value. i hope you could help me..
#7 by Burak on February 9th, 2010
| Quote
Can you copy paste your error message via http://pastebin.com/ please?
#8 by Ivan Rivera on February 10th, 2010
| Quote
Hello again. here is the error message
http://pastebin.com/m3af7587e
but something strange happens, when i try to load fixtures in my local computer with Windows, Apache, MySQL and PHP, I see the error message described before, but when i load the files in the server with Linux, Apache, MySQL and PHP everything runs perfectly.
#9 by Burak on February 10th, 2010
| Quote
Looks like you are running MySQL in strict mode.
Open my.ini in your MySQL installation folder. Find a line that looks like this:
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
Delete this part: STRICT_TRANS_TABLES,
Restart MySQL.
#10 by Boi Huynh on February 10th, 2010
| Quote
Hi Burak, I get an error when I click button create_table. I posted message via http://pastebin.com/. Please help fix it.
Thanks Burak.
#11 by Burak on February 10th, 2010
| Quote
I need the full url. That’s just the homepage url.
#12 by Boi Huynh on February 23rd, 2010
| Quote
Thanks Burak. I fixed that error. (error create key foreign).
#13 by Adam on February 10th, 2010
| Quote
Hello, Great series can you cover the search feature of doctrine? I can’t see a way to create a DQL query which does something similar to SQL full text search. At present I can only see a way of doing a ‘AND’ search using the Doctrine ‘->search()’ method, is there an ‘OR’ search for the ‘->search()’ method? Thanks. Looking forward to the next tutorial.
#14 by zack kitzmiller on February 10th, 2010
| Quote
Burak, still great series. I’d assume we’ll get to adding posts at some point
You should put that donate button back
#15 by Paul Chater on February 10th, 2010
| Quote
Again, Burak…
Great work. Love it. Keep em’ coming! Hopefully the next one will be released in a week?
lol.
#16 by Mohamed Mahmoud on February 11th, 2010
| Quote
Great work … Thanks for this awesome series .. Waiting your new one
#17 by Lasse on February 12th, 2010
| Quote
Hi Burak,
Im really enjoy this series. I´m pretty new into CI and MVC.
I have a question about the protected function in the usermodel to encrypt password. I creating a forgot password function. But when it save the password it dont save it encrypted. I use DQL if that make difference?
#18 by Burak on February 13th, 2010
| Quote
If you are inserting with DQL, i don’t think that function will be used. You might need to call it manually.
#19 by Zack Kitzmiller on February 15th, 2010
| Quote
Where are you placing that function, Lasse? In the User Model?
#20 by Richard on February 23rd, 2010
| Quote
this example doesn’t follow the tutorial exactly – notice tablename and field are named differently plus there is a slat field.
provided you use the field name correctly this works.
everytime password is saved a new salt is generated and the password is encrypted with that salt – salt get saved too
generate your password in current_user if lost a password
BaseEmployee is a generated model from employee table – eg user table in your case
class Employee extends BaseEmployee {
public function setUp() {
$this->hasMutator(‘passwd’, ‘_encrypt_password’);
}
protected function _encrypt_password($value) {
$salt = $this->_new_salt();
$this->_set(‘passwd’, md5($salt . $value));
}
protected function _new_salt() {
$salt = substr(md5(uniqid(rand(), true)), 0, 16);
$this->_set(‘salt’, $salt);
return $salt;
}
}
fix the encryption as you see fit
#21 by Richard on February 23rd, 2010
| Quote
I dont want to overload this tutorial with comments as it is great – it has got me excited about the next project. think you may need this as I don’t know if the above affects the tutorial login.
I had to change the login – yes to dql
public static function login($username, $password) {
// get User object by username
$q = Doctrine_Query::create()
->select(‘id,login,empname’)
->from(‘Employee user’)
->where(“user.login = :login and user.passwd = MD5(CONCAT(`salt`, :password))”,array(‘:login’ => $username, ‘:password’ => $password));
//notice backward quote on salt telling mysql to use the field – not sure if this is cross database
//$u = $q->fetchOne();
$u = $q->execute(); //execute returns array so reference result as array
if ($u->count() > 0) { //can also check exists?
$CI =& get_instance();
$CI->load->library(‘session’);
$CI->session->set_userdata(‘user_id’,$u[0]->id);
self::$user = $u[0];
return TRUE;
}
// login failed
return FALSE;
}
#22 by Lasse on February 15th, 2010
| Quote
Yes Zack, its a protected function in User model. But obviously it isn´t used when using DQL.
#23 by Philippe de Chabot on February 18th, 2010
| Quote
It’s a great serie. Can’t wait for the rest.
#24 by jant on February 19th, 2010
| Quote
Congrats Burak for this so useful series. Only one question: I’m surprised to see you’re using WordPress for this blog and it’s so clear that you are able to manage personalized CMS with these amazing and powerful tools. Would you be so kind to explain your reasons?
Sorry for my English, greetings from Andalusia and thanks again. Awaiting for more soon.
#25 by Burak on February 20th, 2010
| Quote
I’m not sure if I understand the question. Why exactly are you surprised that I am using WordPress for this blog?
#26 by jant on February 21st, 2010
| Quote
Well, maybe the word “surprised” is not the more appropriate. Just for curiosity, I was wondering what’s your reasons for use WP instead to build your own CMS with CodeIgniter + Doctrine. I don’t know if it’s because it’s a lot of unnecessary work or WP is all you need or…
Thanks for your attention.
#27 by Zack Kitzmiller on February 22nd, 2010
| Quote
I would assume it’s because there’s not reason to reinvent the wheel.
#28 by Burak on February 22nd, 2010
| Quote
Wordpress already works well enough for now. It wouldn’t justify the time I would have to invest in building something custom.
#29 by Alex on February 20th, 2010
| Quote
It’s the ONLY framework tutorial series that REALLY help to LEARN. Thank you!
#30 by seekbob on February 21st, 2010
| Quote
I found your blog from nettuts….
before, I really don’t know about doctrine, but this is very helpfull plugin for codeigniter…
thanks for this tutorial series… very deep and really nice!
#31 by Jonathan on February 27th, 2010
| Quote
This has been *the* best tutorial I’ve ever come across on ci and doctrine, and in fact has taught me doctrine when nothing else Ive come across has helped me put the pieces together.
I’m begging you to continue – I’d love to continue to learn more. Seriously, you should do a paid tutorial, or run some classes on webcast – I for one would be happy to pay to attend.
#32 by Jonathan on February 27th, 2010
| Quote
For the sake of losing my learning codebase, I updated to the downloaded version here, dropped all the tables in the db, and ran doctrine tools’ create_tables and load_fixtures/true
With this clean install, I’m getting a 404 error (it’s showing up in the access log, but not in the error log somehow – there’s just nothing) on /threads/display/1
/forums/display/1 works like a charm. I’m kind of confused – did I miss something? I’m not getting any error messages so it’s requiring more brain power than I think I have yet.
Has anyone else run into this before?
#33 by Jonathan on February 28th, 2010
| Quote
Another retarded question. Let’s say I wanted to extend your singleton pattern to make it a totally login protected application (redirect only to /login). How would you go about doing that?
Hours of fiddling later, no idea why the 404 is happening. But this is the “right way” to be using CI. Props.
#34 by Richard on March 3rd, 2010
| Quote
I use a template (which uses the controller class) then each class uses that page instead of the controller class – I guess this could be done another way
in the template use
/* override only on pages that need to be public */
public function is_logged_in () {
if ( Current_User::user())
return TRUE;
else
redirect(‘login’);
}
in the login page and any other page that doesn’t require login override that function with something like this
public function is_logged_in () {
if ( Current_User::user() )
redirect(‘/’);
else
return false;
}
I’m sure someone will show us both a better way but it works while the app is being developed.
#35 by Hannes on February 28th, 2010
| Quote
Thanks for this awesome series ^^
Do you plan some kind of “AdminPanel” ? That would be very nice and helpful if you want to do something else with the gained knowledge.
#36 by Jaspal Singh on March 12th, 2010
| Quote
Thanks for sharing such a wonderful series of codeigniter tutorial.
When you will be publishing Day 12?
#37 by Saul on March 17th, 2010
| Quote
Great tutorial! Finally caught up. I feel comfortable reading Doctrine’s documentation now thanks to this tutorial getting me started. Before, I had no idea where to start. Transaction and Caching would be nice to hear more about.
Just heard Codeigniter 2.0 is doing away with plugins, so Doctrine would have to be loaded as a helper in the new version.
#38 by Haqqi on March 23rd, 2010
| Quote
Hi, I’m just a new CI lover.
The one things i want to know, is there any problem, if we use Doctrine instead of database CI, the session database will make an error or not? thanks…
#39 by Burak on March 23rd, 2010
| Quote
I don’t think it will be a problem. Just give it a try and see what happens
#40 by Haqqi on March 24th, 2010
| Quote
I want to integrate CI+Doctrine+Matchbox, so that my application can be modular. here is the library http://codeigniter.com/wiki/Matchbox/
The first setup, before adding matchbox, it runs well. but i have this following error after adding matchbox, I don’t know why. Can you give a suggestion?
Fatal error: Uncaught exception ‘Doctrine_Manager_Exception’ with message ‘No database available in data source name’ in D:\Programming\Web Project\HQFramework\ci_core\plugins\doctrine\Doctrine\Manager.php:480 Stack trace: #0 D:\Programming\Web Project\HQFramework\ci_core\plugins\doctrine\Doctrine\Manager.php(303): Doctrine_Manager->parseDsn(‘mysql://:@local…’) #1 D:\Programming\Web Project\HQFramework\ci_core\plugins\doctrine\Doctrine\Manager.php(265): Doctrine_Manager->openConnection(‘mysql://:@local…’, ‘default’) #2 D:\Programming\Web Project\HQFramework\ci_core\plugins\doctrine_pi.php(34): Doctrine_Manager::connection(‘mysql://:@local…’, ‘default’) #3 D:\Programming\Web Project\HQFramework\mainapp\libraries\Loader.php(381): include_once(‘D:\Programming\…’) #4 D:\Programming\Web Project\HQFramework\mainapp\libraries\Loader.php(361): CI_Loader->plugin(‘doctrine’) #5 D:\Programming\Web Project\HQFramework\mainapp\libraries\Loader.php(764) : eval()’d code(968): CI_Loader->plugin(Array) #6 D:\Programming\Web Projec in D:\Programming\Web Project\HQFramework\ci_core\plugins\doctrine\Doctrine\Manager.php on line 480
#41 by Joshua on July 12th, 2011
| Quote
Hello Haqqi, how did you solve this problem? What did you do to fix it and get it working. I am getting a similar error when trying to connect to an oracle DB using doctrine ORM.
#42 by Joshua on July 12th, 2011
| Quote
I found the solution.I didn’t realize that not specifying the database name will cause errors even if the database name isn’t relevant when connecting to an Oracle Database.
$db['default']['database'] = ” “; (doesn’t work)
$db['default']['database'] = “xe”; (works)
#43 by Haqqi on March 24th, 2010
| Quote
I’m sorry, just my configuration. I made a mistake. Problem solved.
#44 by Elbi on March 24th, 2010
| Quote
PLEASE CONTINUE THIS SERIES.
It’s better then the webcasts on nettuts
#45 by Elbi on March 24th, 2010
| Quote
than*
#46 by Chris on March 25th, 2010
| Quote
Any plans to fill out the rest of this tutorial? It is honestly one of the best I have seen in a long time. Has helped a lot.
#47 by Josh Bright on March 25th, 2010
| Quote
Just wanted to say thanks for making these tutorials, they are top notch! Love how they start from scratch, and usually are a bit more than a barebones implementation of something.
#48 by Hakan Müştak on March 26th, 2010
| Quote
Great tutorial! Thank you!
#49 by Elbi on March 29th, 2010
| Quote
ARGH I just don’t understand how to insert threads after applying this relation.
#50 by Preston on April 9th, 2010
| Quote
Awesome tutorials!
Any chance of a tutorial on caching? I tried setting up an sqlite Query Cache and Result Cache per the Doctrine manual, but it didn’t reduce my main db queries, it just added new queries to the cachedb. I must have been doing something wrong.
I’m not even sure Doctrine-level caching is the best solution. If caching could be controlled at the view output level, that would give you options for pages that include both frequently updated content, and fairly static content.
Any suggestions, anyone?
#51 by John L Charette on April 18th, 2011
| Quote
I agree. I’d like to introduce memcache into my website, but I’m unsure how. Doctrine’s site http://www.doctrine-project.org/documentation/manual/1_0/en/caching:drivers:memcache says to drop the files into the bootstrap.php, but we don’t have one of those. I’m not sure if I have to make one, and then start it that way or what.
Can someone point me in the right direction for memcache integration with CI 1.7 and Doctrine 1.2?
Thanks
#52 by Angelo on April 11th, 2010
| Quote
Hey – nice one as usual.
Wouldn’t Day 12 or 13 be a good opportunity to work on hierarchical data support, e.g. NestedSets?
Angelo
#53 by Stefan Pausch on April 18th, 2010
| Quote
Thanks alot for this superb tutorial! – It is one of the finest i have seen. It took me two days to work through it and i need some more time to understand it in its details. It helped me to get a good overview how rapid you can develop with doctrine and how easy (and sometimes complicated) things can get. I love the datail you put into your tutorials – f.e. query optimization. I would love to see further tutorials of you. Thanks alot!
#54 by Anaxamaxan on May 6th, 2010
| Quote
Burak I’ve gone through this whole series over yesterday and today. You’re an extremely effective teacher. Your tutorials are way better than most of the books published. I’m considering coming to EECI2010 just to attend your CI class! Consider this a +1 to continue the series, even for a fee. Cf Ryan Irelan’s EE screencasts on PragProg.com.
#55 by erminio ottone on May 16th, 2010
| Quote
Yeah, i love those tutorials too
Just hope there wil be some more
#56 by Edtek on May 18th, 2010
| Quote
Please i followed your tutorial about using codeigniter with doctrine and i was able to develop an application.but i am having some problem with doctrine.
I have this array structure Array
(
[0] => Array
(
[id] => 1
[preacherid] => 1
[title] => Come Back To The Bible
[mp3audio] => 08-0713.mp3
[mp4video] => 08-0713.mp4
[photo] => 08-0713.jpg
[/code] => 08-0713 [hits] => 0 [is_active] => 1 [created] => 2010-04-06 [status] => M [userid] => 1 [created_at] => 2010-04-06 14:51:10 [updated_at] => 2010-04-06 14:51:07 [Preacher] => Array ( [id] => 1 [firstname] => Theophilus [lastname] => Adukpo [is_active] => 1 [userid] => 1 [created_at] => 2010-04-06 14:49:19 [updated_at] => 2010-04-06 14:49:25 ) ) ) but i want the array structure as Array ( [0] => Array ( [id] => 1 [preacherid] => 1 [title] => Come Back To The Bible [mp3audio] => 08-0713.mp3 [mp4video] => 08-0713.mp4 [photo] => 08-0713.jpg [code]=> 08-0713
[hits] => 0
[is_active] => 1
[created] => 2010-04-06
[status] => M
[userid] => 1
[created_at] => 2010-04-06 14:51:10
[updated_at] => 2010-04-06 14:51:07
[id] => 1
[firstname] => Theophilus
[lastname] => Adukpo
[is_active] => 1
[userid] => 1
[created_at] => 2010-04-06 14:49:19
[updated_at] => 2010-04-06 14:49:25
)
)
i am actually joining two tables called sermon and preacher with the following DQL
public function latestServices(){
$status = 1;
$query = Doctrine_Query::create()
->select('s.id,p.firstname,p.lastname')
->from('Sermon s')
->innerJoin('s.Preacher p ON s.preacherid = p.id')
->where('is_active =?',$status)
->orderBy('created DESC')
->limit(15);
$latestService = $query->execute();
return $latestService->toArray(true);
}
Please can you help me out to get the second array structure?i have sat on this for weeks and no solution seems to come to mind.
Thanks
#57 by mark r on May 30th, 2010
| Quote
just on a side note.. did you know the word “burak” in Polish means, beet? It is also a word used to describe country folk in a slanderous way. In spite of all of that, I think you are cool and your tutorials are outstanding, please keep going, and I hope someone lets you write a book about this, you could make some serious ca$h!
#58 by Burak on June 6th, 2010
| Quote
That’s interesting
#59 by Seradon on June 11th, 2010
| Quote
Tnx for these tutorials.
This is my first contact with CI, and it’s an excellent starters guide.
#60 by davide on June 16th, 2010
| Quote
can you post some example for create a Base model like an extendend CI model
ex:
http://pastebin.com/9FEbc9y6
#61 by shiddiq on June 18th, 2010
| Quote
Well… still patient to see the 12 tutorial… hihihi
these tutorials are Very2 cooooolllll….
Tnx for these tutorials
#62 by Rui Lima on July 4th, 2010
| Quote
All this tutorials are very cool. I was wondering if you could publish some nice and simple tutorial for integrating CI 2.0 and Doctrine 2.0.
I would like to use doctrine2 annotations and then execute the cli to generate the db from my models. But i’m unable to put CI 2.0 working with doctrine 2.0.
I saw some posts on CI forum related to this topic but none could be helpful…
I guess you would help a lot of guys out there…
#63 by krc on August 17th, 2010
| Quote
I have CI 1.7.2 set up with Doctrine 1.2, with cli working correctly (on windows).
Give me a note, I can send You sandbox, should be the same setup at 2.0..
#64 by marios88 on July 15th, 2010
| Quote
OK. you are awesome keep the tutorials coming, this is one of the best CodeIgniter tutorials ever
#65 by newtoCI on July 18th, 2010
| Quote
Thank you very much for this entire series so far. It’s been great. I would love for you to continue it. I’ve tried to go on ahead and add some content such as displaying user profiles, actual posts and creating new posts. However I’d love to see how you implement it and compare them.
Please continue the great series burak.
#66 by Antonio on July 19th, 2010
| Quote
Thank you
#67 by marios88 on July 20th, 2010
| Quote
keep them coming!
#68 by Richard on July 20th, 2010
| Quote
just tried my app in CI 2.0
moved the plugin stuff to helpers, changed a few paths, changed the auto load and it works fine
#69 by Chris Baines on July 21st, 2010
| Quote
Any more coming soon ?? seems to have gone quiet and i was hoping these would keep coming
#70 by Sajid Ali Mudassar on July 29th, 2010
| Quote
“This entry was posted on Monday, February 8th, 2010″
Its been very long, and we are really waiting for more…. Please continue the series.
Thank you very much.
#71 by maswewe on September 2nd, 2010
| Quote
nice tutor.. can’t wait for the next ‘Day 12 one..’
#72 by Petar Blazevski on September 23rd, 2010
| Quote
What happened with DAY 12?????
#73 by jokerbla on September 23rd, 2010
| Quote
Same question, day 12?
#74 by Chad on September 27th, 2010
| Quote
Yes, will you be continuing this series? We are waiting anxiously…
#75 by Hao on October 2nd, 2010
| Quote
Please continue the series. we all love this. I’ve followed this from the very first post, and I’ve learned so much from you!
#76 by awi on October 9th, 2010
| Quote
i’am from Indonesia ..just wanna say Please continue the great great series.
thanks
#77 by Amine on October 23rd, 2010
| Quote
Thank you for this serie of tutorials that made everything look easier with Codeigniter and Doctrine. No other tutorials match the quality of what you gave us.
In fact it doesn’t even matter if there is a day 12 or not … the previous days gave us a pretty complete overview of how to build a forum.
Thank you again Burak
#78 by Denny on October 24th, 2010
| Quote
Just to say hello to Burak and ask him whether he’ll get spare time to continue with these excellent series?
Best regards from Bosnia!
#79 by altrano on October 26th, 2010
| Quote
Please bring the next Series of this very hot Tutorial, i can’t wait for it
#80 by Mattia on November 15th, 2010
| Quote
Hello Burak!
I have been following your tutorials from day 1 to day 11, but as I can see it has been a long time since you updated these. I really love these tutorials and they helped me all, are you still bringing out the next chapters?
#81 by Hardik on December 3rd, 2010
| Quote
Many Many thanks ……….
Please post new series, I am waiting for that..
#82 by Maria on December 6th, 2010
| Quote
Hi and congratulations for the series!
Absolutely excellent work!
I have 2 questions though:
a) Are you planning to continue on or should we consider it done?
(..as you can understand we are dying to see a newer article!..)
b) A little irrelevant but I’ve been tearing my hair off for hours now!.. (..please don’t laugh..)
How do you handle the code expansion I’ve seen you doing in the NetTuts screencasts???
“html:4″ …etc (and I believe you press Alt or something to expand it)
I tried it with Aptana’ s php and html/css templates but it does not always work (..I guess because it’s context sensitive based on the active editor and caret position).
I have also tried out the amazing PhraseExpress for Windows but it doesn’t play well with Aptana (and other java based environments).
Thanks in advance,
Maria
..keep up the amazing work!
#83 by Burak on December 7th, 2010
| Quote
a) I would like to continue, but can’t promise anything right now
b) I use ZenCoding http://code.google.com/p/zen-coding/ . It works with Aptana and some other editors.
#84 by Michael Schmidt on December 7th, 2010
| Quote
@Maria: Could you please try the latest PhraseExpress version 8 that includes improved Java application support:
http://www.phraseexpress.com/phraseexpress.exe
Please let us know your feedback if it works better now.
Michael Schmidt
PhraseExpress Team
#85 by Maria on December 7th, 2010
| Quote
@Burak: Thanks for the info. ZenCoding is the only solution I haven’t tried yet.. (..as always
)
As for the tutorials I can imagine that are very very time consuming.
Anyway, I just wanted you to know that all of us would be glad if you could find the time to keep it up. And if not, thank you for the series as it is until now.
@Michael Schmidt: Thanks Michael for the info. 3 days ago I used the normal download link from your website but it lead me to v7.
Maybe this should be corrected.
I’ll use the download link you provided me here and report back the result.
Again, thanks both of you for helping out!..
Cheers
#86 by Gerson Goulart on January 3rd, 2011
| Quote
Wow! I just found this tuts last night and couldn’t stop reading it ’till I got to the last page! Please keep up with the amazing job!!
I have one quick question though: Since Doctrine already know the structure of the tables, isn’t it possible to use it also to generate the filling forms, say, for example, the login form or the forms to fill the information about the Forums and Threads… Isn’t it possible to build a code that reads the Doctrine object and build the form fields on the fly?
Thanks and congratulations again!
Cheers!
#87 by al way on March 19th, 2011
| Quote
Hi Burak,
Your tutorial is awesome, it is an inpiration for all of us to get doctrine and CI working together. Doctrine 2 and Codeigniter 2 is out, but having to search for information on how to set it up like you did with earlier version in your tutorial is giong no where. Would you or anyone have recomendation on setting up to coding sample of a simple Hello World app?
#88 by Azraf on March 22nd, 2011
| Quote
Thanks for the nice tutorial. Looking for CI 2 and Doctrine 2 settings. and also looking for next episode of this series.
Thanks again.
#89 by Esti on April 6th, 2011
| Quote
thanks!
#90 by DJ on April 15th, 2011
| Quote
Burak… I know just how much time these tutorials take to prepare; but, it’s been a long time (just sayin). Realistically, should we consider this a “done deal” and move on?
I’ve learned a great deal from these but know that we’ve just scratched the surface.
How about considering a couple of alternatives:
a) Just finish the code for the project (which I’m sure you could do a lot faster if you didn’t have to stop and explain everything.) Then let us delve through it and use your comments to “figure it out.”
b) For me screencasts are a lot easier than writing/annotating/photographing/proofreading a written tutorial. Is that an option, there are some free hosting services.
c) Even, just short, 5 minute segments (Like Jeff Way does) would help us.
As you can tell, like described in the book “the little prince,” you have “tamed” many of us who have faithfully followed your work – and would really hope you could complete it if you can.
Good Luck
#91 by mikaela milla on April 20th, 2011
| Quote
I would like to ask if you will create a tutorial for CI 2 and Doctrine 2. Im using CI 2 for but I havent decided on using Doctrine 2 since im still evaluating it.
I want to know if it could take care all the loads from the company ive been working on. like store branches, store branches customers, employees, operations, billings, orders and inventories.
Thanks..
Pingback: CodeIgniter and Doctrine | Me and My Self
#92 by Noura ben afia on May 10th, 2011
| Quote
Great works
#93 by Joshua on July 12th, 2011
| Quote
I am getting the following error when trying to setup my doctrine ORM to work with my Oracle Database.
Fatal error: Uncaught exception ‘Doctrine_Manager_Exception’ with message ‘No database available in data source name’ in /media/disk/aptana/hms/system/application/plugins/doctrine/lib/Doctrine/Manager.php:424 Stack trace: #0 /media/disk/aptana/hms/system/application/plugins/doctrine/lib/Doctrine/Manager.php(232): Doctrine_Manager->parseDsn(‘oci8://hr:profi…’) #1 /media/disk/aptana/hms/system/application/plugins/doctrine/lib/Doctrine/Manager.php(194): Doctrine_Manager->openConnection(‘oci8://hr:profi…’, ‘default’) #2 /media/disk/aptana/hms/system/application/plugins/doctrine_pi.php(24): Doctrine_Manager::connection(‘oci8://hr:profi…’, ‘default’) #3 /media/disk/aptana/hms/system/libraries/Loader.php(466): include_once(‘/media/disk/apt…’) #4 /media/disk/aptana/hms/system/libraries/Loader.php(968): CI_Loader->plugin(Array) #5 /media/disk/aptana/hms/system/libraries/Controller.php(83): CI_Loader->_ci_autoloader() #6 /media/disk/aptana/hms/system/libraries/Controller.php(43): Controller->_ci_initialize() #7 /media/disk/ in /media/disk/aptana/hms/system/application/plugins/doctrine/lib/Doctrine/Manager.php on line 424
#94 by Joshua on July 12th, 2011
| Quote
Yeah! I found the solution. I didn’t realize that not specifying the database name will cause errors even if the database name isn’t relevant when connecting to an Oracle Database.
$db['default']['database'] = ” “; (doesn’t work)
$db['default']['database'] = “xe”; (works)
#95 by Steve on August 13th, 2011
| Quote
Will there be more? I want more?
#96 by Anton on September 19th, 2011
| Quote
What’s happening with this series, is it dead?
I really hope you’ll continue it, since it’s one of the best I’ve come across thus far.
Big ups!
#97 by Hakan on November 20th, 2011
| Quote
Selamlar,
Cok uzun suredir burada ve tutsplus da yazdiginiz yazilari ve kurslari takip ediyorum. Oldukca uzun zaman gecti sanirim yeni yazi yazmayali. Sizden bir ricam var. Eger CI da pivot table olusturmak ile ilgili bir yazi yazarsaniz cok sevinirim.
Saygilar
Pingback: CodeIgniter and Doctrine from Scratch » CodeIgniter Resources
#98 by Beymar on January 21st, 2012
| Quote
Es uno de los tutoriales más objetivos que he podido encontrar en la web…
Gracias por proveernos esta ayuda de mucho valor
#99 by yusman on January 26th, 2012
| Quote
hi, thank you for this great tutorial,
the first, sorry for my bad english,
how do i use doctrin on codeigniter 2.0 ?.you using codeigniter version 1.7, how about version 2.0 ..? becouse version 2.0 is not allow plugin, on your tut doctrin put in plugin
#100 by Cherie on March 27th, 2013
| Quote
Its like you read my thoughts! You appear to know a lot about this, like you wrote the book in it or something.
I think that you can do with some % to power the message home a bit, but other than that, that is wonderful blog. An excellent read. I’ll definitely be back.
#101 by Ganesh Kanawade on April 11th, 2013
| Quote
Wonderful blog. I am waiting for the next post on the same with the details. Keep it up.
#102 by mirena lawsuit on May 2nd, 2013
| Quote
Wow, superb blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of
your site is magnificent, let alone the content!
#103 by sobre la rodilla on June 18th, 2013
| Quote
Great post. I was checking continuously this blog and I am impressed!
I care for such info much.
Very useful info particularly the last part
I was seeking this certain information for a very long time.
Thank you and good luck.