Being inspired by the wonderful series of articles/screencasts on the nettuts website called CodeIgniter From Scratch I decided to write my own series on using CodeIgniter and Doctrine together to build a functional website in a series of tutorials.
In this first part of series, I will show you how to create a basic CodeIgniter install and add Doctrine as a plug-in.
"CodeIgniter and Doctrine from Scratch" Series:
Why add Doctrine to CodeIgniter?
Before we get started, first let me explain the reason I am doing this. Doctrine is an Object Relational Mapper for PHP. It’s OK if you don’t know this term. It basically means that you can map your database tables to classes in your web application. And instances of these classes (i.e. objects) represent records in the database.
This makes it very easy to create, read, update and delete records from the database, while handling them almost like regular objects, so you don’t even have to write any queries. It will also handle relationships between your tables. There are several other benefits that I will not get into until later in these tutorials. See the Doctrine Introduction, if you would like more info right now.
Here is an illustration I put together, that might give you a visual picture.

First Step: Setup your development environment
If you already have a web server with PHP and MySQL setup, you can skip some of this.
- Download and install WAMP (for Mac: MAMP)
Warning Skype Users: You must shutdown Skype first before you start up WAMP, due to a port conflict. After WAMP starts up, you can open Skype again. - Visit http://localhost/ in your browser to make sure it’s working
- Open the “www” folder under the WAMP installation.
- Create a folder named “ci_doctrine_day1″. We will put our files here.
Install CodeIgniter
- Download CodeIgniter
- Extract and copy the contents into your new “ci_doctrine_day1″ folder.
- You may delete the “user_guide” folder.
Your new folders should look like this:

You should see this:

CodeIgniter Crash Course: Controllers
Controllers are called by CodeIgniter on every page load.
They are located under:
system/application/controllers/
The url structure looks like this:
http://localhost/ci_doctrine_day1/index.php/CONTROLLER_NAME/FUNCTION_NAME
For example if you open this url:
http://localhost/ci_doctrine_day1/index.php/hello/world
CodeIgniter will look for a controller class named “Hello” and call it’s method named “world()”.
So let’s create our first controller.
Our First Controller
- Create this file: system/application/controllers/hello.php
<?php
// system/application/controllers/hello.php
class Hello extends Controller {
function world() {
echo "Hello CodeIgniter!";
}
}
You should see:
Hello CodeIgniter!
Please Note:
- The class must extend Controller.
- The class name must be capitalized.
- The file name must be lowercase.
Recommended Reading:
Install Doctrine
CodeIgniter allows us to add plug-ins. That’s how we will be installing it.
- Create this folder: system/application/plugins
- Create this folder: system/application/plugins/doctrine
- Download Doctrine
- Extract the files. Find the folder named “lib” and copy it to system/application/plugins/doctrine.
Now your folders should look like this:

- Create the plug-in file: system/application/plugins/doctrine_pi.php
<?php
// system/application/plugins/doctrine_pi.php
// load Doctrine library
require_once APPPATH.'/plugins/doctrine/lib/Doctrine.php';
// load database configuration from CodeIgniter
require_once APPPATH.'/config/database.php';
// this will allow Doctrine to load Model classes automatically
spl_autoload_register(array('Doctrine', 'autoload'));
// we load our database connections into Doctrine_Manager
// this loop allows us to use multiple connections later on
foreach ($db as $connection_name => $db_values) {
// first we must convert to dsn format
$dsn = $db[$connection_name]['dbdriver'] .
'://' . $db[$connection_name]['username'] .
':' . $db[$connection_name]['password'].
'@' . $db[$connection_name]['hostname'] .
'/' . $db[$connection_name]['database'];
Doctrine_Manager::connection($dsn,$connection_name);
}
// CodeIgniter's Model class needs to be loaded
require_once BASEPATH.'/libraries/Model.php';
// telling Doctrine where our models are located
Doctrine::loadModels(APPPATH.'/models');
// (OPTIONAL) CONFIGURATION BELOW
// this will allow us to use "mutators"
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
// this sets all table columns to notnull and unsigned (for ints) by default
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_COLUMN_OPTIONS,
array('notnull' => true, 'unsigned' => true));
// set the default primary key to be named 'id', integer, 4 bytes
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
array('name' => 'id', 'type' => 'integer', 'length' => 4));
Read the comments in the code for explanations. However, don’t worry if you don’t understand all of it for now.
Database Setup and Configuration
- Open phpMyAdmin: http://localhost/phpmyadmin/
- Create a database named “ci_doctrine”

- Edit file: system/application/config/database.php
- Find the lines below and input the values.
// in system/application/config/database.php // ... $db['default']['hostname'] = "localhost"; $db['default']['username'] = "root"; $db['default']['password'] = ""; $db['default']['database'] = "ci_doctrine"; // ...
We just edited the database configuration file of CodeIgniter.
More Configuration
Almost done.
config.php
- Edit file: system/application/config/config.php
// in system/application/config/config.php // ... $config['base_url'] = "http://localhost/ci_doctrine_day1/"; // ...
Now CodeIgniter knows the url of our site.
autoload.php
- Edit file: system/application/config/autoload.php
// in system/application/config/autoload.php
// ...
$autoload['plugin'] = array('doctrine');
// ...
This makes sure the Doctrine plug-in is always loaded.
Finished!
Now we’re ready to rock. Let’s start testing our setup.
Our First Doctrine Model
Create a user Table
- Open phpMyAdmin: http://localhost/phpmyadmin/
- Go to database “ci_doctrine”
- Create a table named “user” with columns:
id => int, primary key, auto_increment,
username => varchar(255), unique,
password => varchar(255),
first_name => varchar(255),
last_name => varchar(255)
You may use this query:
CREATE TABLE `ci_doctrine`.`user` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 255 ) NOT NULL , `first_name` VARCHAR( 255 ) NOT NULL , `last_name` VARCHAR( 255 ) NOT NULL , UNIQUE ( `username` ) )

Create the Model
- Create file: system/application/models/user.php
<?php
// system/application/models/user.php
class User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('username', 'string', 255);
$this->hasColumn('password', 'string', 255);
$this->hasColumn('first_name', 'string', 255);
$this->hasColumn('last_name', 'string', 255);
}
}
Note:
- We extend Doctrine_Record, instead of Model (which you normally would with CodeIgniter models).
- Inside the function setTableDefinition() we need to define the table structure.
- By default, Doctrine will look for a table with same name as the class. In this case: “user”. (this can be changed)
- In our doctrine_pi.php file above in this tutorial, we specified for a default primary key named “id”. Therefore we don’t need to put it again in our User class.
Testing the Model: Add Some Users
- Edit our controller we created earlier: system/application/controllers/hello.php
<?php
// system/application/controllers/hello.php
class Hello extends Controller {
function world() {
echo "Hello CodeIgniter!";
}
function user_test() {
$u = new User;
$u->username = 'johndoe';
$u->password = 'secret';
$u->first_name = 'John';
$u->last_name = 'Doe';
$u->save();
$u2 = new User;
$u2->username = 'phprocks';
$u2->password = 'mypass';
$u2->first_name = 'Codeigniter';
$u2->last_name = 'Doctrine';
$u2->save();
echo "added 2 users";
}
}
We just generated 2 objects, and populated them with some data. Simply calling save() should save them into our database.
Note:
- We are able to access the fields as parameters (e.g. $u->username), even though we did not create these as class parameters. Isn’t Doctrine nice?
- If you are familiar with CodeIgniter, you might remember that you need to call $this->load->model() function to load models. However since we registered the autoload function of Doctrine, just saying “new User;” is enough.
- We didn’t create the “save()” function, because it comes from the Doctrine_Record class we extended. It saves the objects to the database. There are many other functions and goodies that come with Doctrine classes, we will see later in the tutorials.
You should see output:
added 2 users
- Now go back to phpMyAdmin: http://localhost/phpmyadmin/
- Browse the table ‘user’
Voila! Now you should be able see the 2 new records that just got created.

Stay Tuned
We just saw how to install and setup CodeIgniter with Doctrine. It took some work, but now we have a powerful MVC framework and ORM combination.
In the next tutorials, I will show you more practical examples and eventually build a functional website. You will see how easy it is to create models with Doctrine and save time from having to write repetitive CRUD (Create, read, update and delete) functions in all of your models.
Doctrine will also help us handle the relationships between our classes, and let us avoid writing complex logic code and queries.
See you next time!

Pingback: Tweets that mention CodeIgniter and Doctrine from scratch.Day 1 – Install and Setup. | PHP and Stuff -- Topsy.com
#1 by David Ferguson on October 29th, 2009
| Quote
Any plans to turn these into screencasts? I am tempted to read it but honestly, I really hate sitting here reading through something this long. Chances are I typically know most of it, but then I try to skim over the stuff and I’ll miss one little thing that was important
I’m lazy, what can I say? haha
#2 by Burak on October 29th, 2009
| Quote
Yea, I am planning on doing some screencasts in the near future. But I don’t think they can replace the article format entirely.
#3 by RexDomz on July 18th, 2010
| Quote
I’m just new to php particularly CI. But i guess reading is merely good for those individuals that have enough time to explore. And i agree with your suggestions. But for me this tuts is pretty good and i learned a lot of this stuff! Thank you!
For the author:
Can you give us the list of the class and methods for doctrine and also more examples? I really lyk your tuts!
#4 by DANIEL BRAHM on October 29th, 2009
| Quote
I have been working with CI for 2 years and I am always checking for more about ci. Keep your great job!
#5 by kodegeek on October 29th, 2009
| Quote
Hi, i’ve followed every steps as above, in Mac with php 5.2.6 and mysql 5.0.41 using MAMP, if i hit the worl method – it shows fine but if i hit for test user, nothing comes – just a blank page! I realy like your post that implements ORM feature. Here are the error log i found(which seems no error)
DEBUG – 2009-10-30 06:04:19 –> Config Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Hooks Class Initialized
DEBUG – 2009-10-30 06:04:19 –> URI Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Router Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Output Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Input Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Global POST and COOKIE data sanitized
DEBUG – 2009-10-30 06:04:19 –> Language Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Loader Class Initialized
DEBUG – 2009-10-30 06:04:19 –> Plugin loaded: doctrine_pi
DEBUG – 2009-10-30 06:04:19 –> Controller Class Initialized
Thanks
#6 by Burak on October 29th, 2009
| Quote
Try adding some echo statements inside the user_test() function. Both at the beginning and also between the lines.
See if you get any output at all.
Also I had a missing parenthesis at the end of the SQL query for generating the user table, I just fixed that.
#7 by Pierce on October 29th, 2009
| Quote
This is a great first look into Doctrine, which I have been interested in for some time. Great job
#8 by Aziz Light on October 30th, 2009
| Quote
Great job! I can’t wait for the next tutorials, and the eventual screencasts.
Also, I totally agree with you: as much as I love screencasts, a screencast can entirely replace a written article.
By the way I had a (weird) question. Since we’re using Doctrice to extend our models, can’t we remove all the Model class, database drivers, etc that we are not using anymore so that the whole app become smaller? or that might break CI?
#9 by Burak on October 30th, 2009
| Quote
You can delete the entire database folder if you want. But I believe CodeIgniter doesn’t load the database libraries unless you ask it to. So we’re already saving memory and execution time by not loading them.
Model is a very small component, but if you really want to remove it, first you need to delete this line in doctrine_pi.php:
require_once BASEPATH.’/libraries/Model.php’;
#10 by Aziz Light on October 30th, 2009
| Quote
Yeah obviously if I use doctrine I won’t autoload the database library (which I do normally). My point is to save space, but since the database folder is indeed very small it’s not worth it.
By the way, I absolutely love how you designed your comments display, with the thumbnail of the author’s site and the Reply | Quote links appearing on hover.
Actually, the whole design of the site is really cool. Good Job!
#11 by Kyle Farris on October 30th, 2009
| Quote
I second Aziz… this was very informative. I’ve always been very interested in trying Doctrine in Codeigniter but was never motivated enough to sit down and figure it out. It’s nice when people do that for you (and do it well).
Can’t wait for the tutorial/screencasts. My two cents: If every tutorial was written, I wouldn’t care… I’d read them all… it’s the content that matters to me, not the medium of delivery.
Once again, great job.
#12 by Rafael F P Viana on October 31st, 2009
| Quote
Very nice walkthrough, its on my delicious allready.
Great job!
Trackback: MVCForge - News for MVC Web Developers
#13 by iDVB on November 3rd, 2009
| Quote
Nice Tut Burak! Wish I had this when I first got started!
Got a question for you that you might have solved regarding this plugin.
Can you (or anyone) have a peak at this?
http://codeigniter.com/forums/viewreply/659878/
I feel like I have a good handle on everything doctrine except this issue.
Cheers!
#14 by Burak on November 3rd, 2009
| Quote
The link to the plugin in that article is broken, so I can’t take a look at the code.
However, from what I understand, Doctrine is just passing you an error from MySQL regarding a foreign key violation issue.
Is it trying to drop the tables one by one, or is just calling Doctrine::dropDatabases(); ?
#15 by iDVB on November 3rd, 2009
| Quote
My apologies…I thought you were using this same plugin in this tut. s this not the case? I see you have doctrine setup as a “plugin” and that other url I gave was the first time I had seen it bootstrapped this way.
If your way is indeed setup differently…then can I ask….are YOU able to use Doctrine::dropDatabases(); even when there are FKs without getting errors?
The plugin I mentioned simply did this:
function doctrine_destroy_database() {
$conn = Doctrine_Manager::getInstance()->getCurrentConnection();
$models = Doctrine::getLoadedModels();
foreach($models as $model) { $conn->export->dropTable(Doctrine::getTable($model)->getTableName());
}
}
#16 by Burak on November 3rd, 2009
| Quote
No I’m not using that one. Can you e-mail it to me? programming[AT]gmail.com
Doctrine::dropDatabases() should work. You might also need to call Doctrine::createDatabases() before creating tables.
But be careful with it, because it will drop the entire database, so if there are non-Doctrine tables, they will be dropped too.
#17 by Bradigan on November 3rd, 2009
| Quote
Great tutorial! Just found it on Google today.
I have the exact same problem as KodgGeek above. Same Debug (no errors). I’m also on a Mac running PHP / Mysql.
I did as you mentioned and put several echo statements at the beginning, middle and end of the user_test function, but still nothing.
#18 by Burak on November 3rd, 2009
| Quote
There might be some hidden errors going on. I don’t have a Mac currently to test this.
Maybe error reporting in MAMP is off by default?
Found this article on turning them on: http://www.jhuskisson.com/code-tidbits/re-enabling-error-reporting-in-mamp
#19 by JeffShinn on October 27th, 2010
| Quote
This is true for not only MAMP, but PHP on Xserve. You always need to turn the reporting up since syntax errors will not be displayed and thus a blank page results (rather than the eror line we look for).
Thanks Burak for not just a wonderful ongoing tut, but a great site that I find myself frequenting often!
#20 by Bradigan on November 3rd, 2009
| Quote
Great Suggestion. However I still received a blank page. BUT, I did manage to find this:
and it had the following error:
[03-Nov-2009 20:50:45] PHP Fatal error: Class ‘User’ not found in /Users/brad/Sites/mysite/application/controllers/hello.php on line 13
Like some other tutorials out there, I have moved the /application folder out of the /system folder. I put the folder back in there, but it still did not work.
#21 by Bradigan on November 3rd, 2009
| Quote
BTW, I had a missing ; in one of my lines and now I can get the echo statement at the top of user_test function, so I know its getting called now for sure. I’ll see if I can figure it out, I’ll post the answer here (hopefully)
#22 by Bradigan on November 3rd, 2009
| Quote
Fixed Blank Page Issue:
I had to move the /application/plugins/doctrine so it was in /system/plugins/doctrine
(Remember, I have the application folder out of my system folder).
I then had to move doctrine_pi.php folder to /system/plugins folder.
Lastly, I had to change the doctrine_pi.php file so that this line:
require_once APPPATH.’/plugins/doctrine/lib/Doctrine.php’;
was changed to
require_once BASEPATH.’/plugins/doctrine/lib/Doctrine.php’;
And now everything works!
Thanks AGAIN! Great Series!
#23 by Blue on January 18th, 2010
| Quote
Dear Bradigan,
I’m a very newby for Codeigniter. I’ve found your comments are very useful for me. I have a problem as below:
Fatal error: Class ‘User’ not found in C:\AppServ\www\CodeIgniter\system\application\controllers\hello.php on line 13
I tryed to solve it by following your guide, I moved the doctrine folder into /system/plugins and changed require_once APPPATH.’/plugins/doctrine/lib/Doctrine.php’; to require_once BASEPATH.’/plugins/doctrine/lib/Doctrine.php’;, but it’s still show the same error. Could you please give me any advice?
PS. very sorry for my English ^^
#24 by Rahul Makhijani on July 5th, 2011
| Quote
I am facing the same problem
Pingback: » Les liens de millieu de semaine ! oxynel, blog communication - Agence de communication Montpellier
Pingback: CodeIgniter, ORM, Doctrine | PHP - TechnoFrame
#25 by iDVB on November 9th, 2009
| Quote
Does anyone have any links for good examples, tuts or the like that relate to CodeIgniter, Doctrine and OOP?
Thanks to help from Burak and a few others, I’ve managed to get this implementation combination working 100%. However, could really use some guidance on how Doctrine and CI play in the big picture.
Eg. Let’s say I want to build a website that can have many users and groups with various permissions. As far as security/permissions I would have a Doctrine User Class with function setpassword() would should hash the password. For extensibility, I’d like that actual “hashing” to be done in some kinda external CodeIgniter model called lets say…Auth_model->hashpassword()
Could you/Should you access the CI “Auth_model->hashpassword()” from within the Doctrine “User-setpassword()” function?
I know this is a crap example….but I’m really just trying to wrap my head around these fine ladies. (CI & Doctrine)
Cheers
#26 by Burak on November 9th, 2009
| Quote
It shouldn’t be a model in my opinion, if it’s just for utility. Models are meant to represent data. You can create a helper or library instead.
#27 by iDVB on November 9th, 2009
| Quote
Oh right, however, I’m more concerned with the Doctrine CI part of that example then anything….eg….even as a helper or library…Could you/should you being using a “CI” helper/library from “within” a Doctrine Class (User Class). What would that look like? as I assume you would have to load in the CI classes using “require_once” or something of the like? Reason being that, is it not true, that CI classes are not accessible (for free) from within Doctrine Classes?
Hope some of that makes some sense.
#28 by Burak on November 9th, 2009
| Quote
You need to get the CI superclass, since you can’t do $this->load
$CI =& get_instance();
$CI->load->helper(‘blahblah’);
#29 by iDVB on November 9th, 2009
| Quote
Right…sorry…I did read that before. Is that the proper/efficient thing to do with CI and Doctrine? Eg. If I have a Doctrine User Class that loads that helper….would that not mean that for each time a User Object gets created…that helper will get loaded again and again? Something about this just seem like it might possibly be inefficient? Of course, I’m sure you have a much better handle on it then I, but I had to ask.
#30 by Burak on November 9th, 2009
| Quote
CI knows that a helper is already loaded. When load() is called again on the same helper, it doesn’t actually load anything. Helpers exist globally once loaded, because they are just procedural functions.
And the get_instace() call only gets a “reference” to an object, that already exists. It doesn’t get recreated or reloaded.
I believe it’s an efficient way of accessing/calling CI stuff from within a Doctrine Model.
If you really wanted to get deep into the “best practices” regarding OOP, some people would probably rather use the “Dependency Injection” pattern or something similar. But even CI itself does not follow that convention. I wouldn’t worry too much about it.
#31 by iDVB on November 9th, 2009
| Quote
Thanks again Burak. I’ll paste something useful once I’ve got a bit more into this.
Cheers
#32 by AD on November 10th, 2009
| Quote
One question you have not addressed — Why should we bother adding doctine? What’s wrong with using CodeIgniter as it is? What problem are you addressing and why should I, as a developer, care?
Thanks.
#33 by Burak on November 10th, 2009
| Quote
What do you mean I have not addressed it? The very first section of the article is titled “Why add Doctrine to CodeIgniter?”.
Codeigniter doesn’t have an ORM, it just has the Active Record class, which has limited functionality.
#34 by Kerran on November 11th, 2009
| Quote
awesome tutorial dude, keep up the good work and I look forward to creating this website with you
#35 by walter on November 24th, 2009
| Quote
Great tutorial, keep it going!
Lot of people are googling for ci tutorials nowdays.
Pingback: CodeIgniter – Doctrine ORM Tutorial : A way of enhancing CI « IndiRelease
Pingback: PHP MVC Tutorial series - OSNN Forum
Pingback: CodeIgniter et Doctrine à partir de zéro. Jour 1 – L’installation « Lerni – Le blog du site
#36 by Bruno on November 30th, 2009
| Quote
Really nice tuts, mate. Thanks to share!
Pingback: Обзор e-$ и прочего говна » Blog Archive » 21 Совет по оптимизации MySQL
#37 by Budy on December 3rd, 2009
| Quote
Really a great tutorial, very appreciate it. Thanks for your sharing, Burak
#38 by Sander Versluys on December 4th, 2009
| Quote
Awesome tutorial, i’ve been using CI and Doctrine in a similar way… It’s always nice to see how others did it! Thanks!
#39 by Enrique on December 8th, 2009
| Quote
Awesome tutorial. AWESEOME !!
I didn’t know about Doctrine at all, just heard of it someday…
Thanks !!
#40 by Taylan Bahar on December 9th, 2009
| Quote
Benim iki sorum olacak.
Birincisi : Neden codeigniter? Neden tanıdığım web programcıları codeigniter’ı kötülüyor?
İkincisi : bu alıştırmaların Türkçe’sini yayınlamayı düşünüyor musun?
#41 by mehike on December 12th, 2009
| Quote
excuse me for bad english… but my question:
In one computer in Windows XP system all works fine: Xampp+Codeigniter+Doctrine.
same, but in Linux (lampp+CodeIgniter+Doctrine) I can’t connect mysql with Doctrine (CodeIgniter with models and mysql works fine, connected to mysql) – but If I want use Doctrine in my web page:
A PHP Error was encountered
Severity: Warning
Message: PDO::__construct() [pdo.--construct]: [2002] Invalid argument (trying to connect via unix://)
Filename: Doctrine/Connection.php
Line Number: 474
Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘PDO Connection Error: SQLSTATE[HY000] [2002] Invalid argument’ in /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Connection.php:478 Stack trace: #0 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect() #1 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Transaction.php(186): Doctrine_Connection_Mysql->connect() #2 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Connection.php(1376): Doctrine_Transaction->beginTransaction(NULL) #3 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Export.php(1210): Doctrine_Connection->beginTransaction() #4 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Export.php(1100): Doctrine_Export->exportClasses(Array) #5 /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Core.php(889): Doctrine_Export->exportSchema(NULL) #6 /opt/lampp/htdocs/uusw in /opt/lampp/htdocs/uusweb/application/plugins/doctrine/lib/Doctrine/Connection.php on line 478
in database.php:
$db['default']['hostname'] = “localhost”;
$db['default']['username'] = “rp_user_27″;
$db['default']['password'] = “76rp77FG5er”;
$db['default']['database'] = “rpDB_uusweb_27″;
$db['default']['dbdriver'] = “mysql”;
$db['default']['dbprefix'] = “”;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = “”;
$db['default']['char_set'] = “utf8″;
$db['default']['dbcollat'] = “utf8_unicode_ci”;
in doctrine_pi.php I print dsn string, it’s fine:
mysql://rp_user_27:76rp77FG5er@localhost/rpDB_uusweb_27
in doctrine Connection.php I print values too, before new PDO() command in 473line:
echo $this->options['dsn'].’*';
echo $this->options['username'].’*';
echo $this->options['password'].’*';
I see all fine:
mysql:host=localhost;dbname=rpDB_uusweb_27*rp_user_27*76rp77FG5er*
from linux commandline I can connect to mysql fine… I can’t think, that else I can do?
any help?
#42 by mehike on December 12th, 2009
| Quote
ok I’m find answer: unix_socket in connection string must be:
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['username'] .
‘:’ . $db[$connection_name]['password'].
‘@’ . $db[$connection_name]['hostname'] .
‘/’ . $db[$connection_name]['database'] .
‘;unix_socket=/opt/lampp/var/mysql/mysql.sock’;
#43 by Haqqi on May 27th, 2010
| Quote
Thank you for the solution. This problem makes me crazy in LAMPP.
In windows xampp (that is not using unix_socket), i uploaded it to cpanel shared host (linux OS), it doesn’t overcome any problem.
One question, I haven’t try it. Does it make any problem when we upload the file in cpanel based shared host if we use this script?
#44 by Rafael Monroy on March 1st, 2011
| Quote
Thanks mehike, my proyect continue !!!!
#45 by Fabiano on December 19th, 2009
| Quote
PHP Error was encountered
Severity: Warning
Message: Cannot modify header information – headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/ci/system/application/config/autoload.php:1)
Filename: codeigniter/Common.php
Line Number: 360
An Error Was Encountered
Unable to load the requested file: plugins/doctrine_pi.php
What’s this? How I fix it?
#46 by Ale on December 20th, 2009
| Quote
Thanks dude…very great things!!!
#47 by joe on December 21st, 2009
| Quote
hi,
I was thinking about using an ORM for my projects and thank God you have done this piece. I have a question though, I followed the install just like you said copied the doctrine_pi.php and saved it in the specified folders but it gives me this error when I followed the first example you gave:
Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory.user' doesn't exist' in D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection.php:1084 Stack trace: #0 D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection\Statement.php(253): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement)) #1 D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection.php(1049): Doctrine_Connection_Statement->execute(Array) #2 D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection.php(693): Doctrine_Connection->exec('INSERT INTO use...', Array) #3 D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(595): Doctrine_Connection->insert(Object(Doctrine_Table), Array) #4 D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection\Unit in D:\xampplite\htdocs\inventory\application\plugins\doctrine\lib\Doctrine\Connection.php on line 108I am using xampplite 1.7.2 thanks for all the good work. will expect to hear from you soon.
#48 by Burak on December 21st, 2009
| Quote
It says the table “inventory.user” does not exist. You need to create it first, as described in the article.
#49 by joe on December 21st, 2009
| Quote
you know what I am sooooo sorry for this. I missed an ‘s’ at the end of user. when I got your reply was when i noticed the missing s. I am so sorry.
Cheers
#50 by Tim Reynolds on December 26th, 2009
| Quote
This is a great tutorial. Have never heard of doctrine before, but I definitely intend on following these tuts.
It might be a nice idea to move the application folder outside the systems folder to allow CI to be easily updated. I would also change the name of the application and systems folder for security.
#51 by lechuzo on December 27th, 2009
| Quote
Hi to everyone.
I have this error when I’m trying to run the Day1 tutorial.
I’m working on XP and I have Appserv 2.5.9 with PHP Version 5.2.3, phpMyAdmin Version 2.10.2 and mysql Version 5.0.45-community-nt-log
Could you have an ida about this message? I will really appreciate your help. (Sorry about my English)
Fatal error: Uncaught exception ‘Doctrine_Transaction_Exception’ with message ‘Rollback failed. There is no active transaction.’ in C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Transaction.php:319 Stack trace: #0 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1426): Doctrine_Transaction->rollback(NULL) #1 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(136): Doctrine_Connection->rollback() #2 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1597): Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3 C:\AppServ\www\ci_doctrine_day1\system\application\controllers\hello.php(16): Doctrine_Record->save() #4 [internal function]: Hello->user_test() #5 C:\AppServ\www\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #6 C:\AppServ\www\ci_doctrine_day1\index.php(115): require_once(‘C:\AppServ\www\… in C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Transaction.php on line 319
#52 by Burak on December 27th, 2009
| Quote
Look at my comment here about Appserv: http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-4-user-login/comment-page-1#comment-303
See if that solves your issue.
#53 by lechuzo on December 29th, 2009
| Quote
Thanks a lot!!! I’m sorry about my hurry. When I read this link everything went right. I’m still learning with your tutorial.
Pingback: Чуть более 20 хороших советов по MySQL (часть 2) » Пара слов о программировании
#54 by Максим on December 31st, 2009
| Quote
Занятная статья, да и сам сайт я смотрю очень даже не плох. Попал сюда по поиску из Гугла, занес в закладки
#55 by Naim on January 2nd, 2010
| Quote
Would you be soo Kind to show us how to install Doctrine with Kohana please. If you have used at all?
Thanks
#56 by Кирилл Александров on January 5th, 2010
| Quote
Действительно интересно написанно, я наверное бы так не смог.
Pingback: CodeIgniter Clan Site – Part 1 | PHP Tutorials
#57 by Blue on January 19th, 2010
| Quote
hi All,
I’m a very newby for CodeIgniter. Now, I’m trying to do Web Application Project using Codeigniter. I’ve tried to follow Day 1 – Install and Setup. I faced the problem below:
Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘Couldn’t locate driver named mssql’ in C:\AppServ\www\ci\system\plugins\doctrine\lib\Doctrine\Connection.php:486 Stack trace: #0 C:\AppServ\www\ci\system\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(54): Doctrine_Connection->connect() #1 C:\AppServ\www\ci\system\plugins\doctrine\lib\Doctrine\Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(Users)) #2 C:\AppServ\www\ci\system\application\controllers\hello.php(17): Doctrine_Record->save() #3 [internal function]: Hello->user_test() #4 C:\AppServ\www\ci\system\codeigniter\CodeIgniter.php(232): call_user_func_array(Array, Array) #5 C:\AppServ\www\ci\index.php(115): require_once(‘C:\AppServ\www\…’) #6 {main} thrown in C:\AppServ\www\ci\system\plugins\doctrine\lib\Doctrine\Connection.php on line 486
I use :
- Apache Web Server version 2.2.8
- PHP Script Language version 5.2.6
- Microsoft SQL server
Could you please help me solve this problem?
Thank you very much. ^^
#58 by Burak on January 20th, 2010
| Quote
You need to make sure the MsSQL driver is enabled with PDO.
#59 by Daryl Wood on March 23rd, 2010
| Quote
I have a similar connection problem with MySQL.
Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘Couldn’t locate driver named mysql’ in C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php:486 Stack trace: #0 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\Mysql.php(101): Doctrine_Connection->connect() #1 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(54): Doctrine_Connection_Mysql->connect() #2 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\controllers\hello.php(17): Doctrine_Record->save() #4 [internal function]: Hello->user_test() #5 C:\inetpub\wwwroot\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #6 C:\inetpub\wwwroot\ci_doctrine_day1\index.php(115): require_once(‘C:\ in C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php on line 486
How do I make sure the MySQL driver is enabled?
Thanks for time it took you to produce the tutorial.
#60 by Burak on March 23rd, 2010
| Quote
This line in your php.ini file:
extension=php_pdo_mysql.dll
#61 by Asakurayoh on January 19th, 2010
| Quote
Hi.
I just can get this work. I use Doctrine 1.2 and the autoload doesn’t seem to work.
(Don’t find my Model, and if I include the model (with include), it doesn’t find Doctrine_Record……..)
Do you have an idea how to do?
I’m on Wampserver on Windows XP.
Thanks.
#62 by Burak on January 20th, 2010
| Quote
I am not sure. Try downloading the zip file provided at the beginning of the article.
#63 by Joakim Kejser on January 20th, 2010
| Quote
Hi Burak.
I really like the combination of codeigniter and doctrine, thank you very much for the article. It’s by far the slickest implementation of doctrine in codeigniter i’ve seen.
I just have a single question, why bother loading the CI models library from the doctrine plugin?
#64 by Burak on January 20th, 2010
| Quote
When I had a model that was extending the CI Model class, i was getting errors. Some people might be using both CI Model’s and Doctrine Model’s at the same time, that’s why I included that.
Later I found a way around it actually. Just need to add one more Doctrine autoloader just for models (which is actually lacking from the official documentation for some reason), and set the loading to conservative (it’s aggressive by default so it loads all models).
#65 by Patrick Fraley on January 23rd, 2010
| Quote
Moin Burak,
Is it also possible to install the doctrine into the system/plugins folder? I have my server setup to have a single CodeIgniter installation to be used by multiple virtual hosts/applications and I would like to have doctrine available in all those apps without having an installation of doctrine in all of them (hard to maintain)?
#66 by Patrick Fraley on January 23rd, 2010
| Quote
Sorry I noticed someone did that already, made the changes to the doctrine_ci.php (line 5 changed APPPATH to BASEPATH). Will test later if it still works
thanx for posting these cool tutorials
#67 by jävi on January 26th, 2010
| Quote
Hi Burak,
Firstly, really great tutorial, thank you!.
Just one question. What about generation the models from the DB with Doctrine? I mean this:
Doctrine_Core::generateModelsFromDb(‘models’, array(‘doctrine’), array(‘generateTableClasses’ => true));
I tried to do it but nothings happens, no errors and no models anywhere.
Can you figure out why?
Thank you!
#68 by Burak on January 29th, 2010
| Quote
The first parameter should be the path to the models folder, which should be this:
APPPATH.’/models’
and the folder should probably be writable too
but I don’t understand why it didn’t give you an error.
#69 by San on March 23rd, 2010
| Quote
Hi,
I generated the model as follows.
1. Create a file called PHH file (doctrine_bootsrap.php) in the CodeIgniter root folder.
2.
require_once(dirname(__FILE__) . ‘/system/plugins/Doctrine/lib/Doctrine.php’);
spl_autoload_register(array(‘Doctrine’, ‘autoload’));
Doctrine_Manager::connection(‘mysql://root:toor@localhost/ci_doctrine’);
Doctrine::generateModelsFromDb(dirname(__FILE__) . ‘/application/models’);
Add these code to that page (modify the path if required.)
3. execute the created file by url as follows
http://yoursitename.com/doctrine_bootsrap.php
It will generate the model classes.
San.
#70 by swapnil on January 27th, 2010
| Quote
tanx dude for the step by step illustrations…wonderful article…tanx a ton…!!!
#71 by a.k.d. on January 31st, 2010
| Quote
thanks for your great tutorial !!
helped me a lot
however, in case using Doctrine 1.2, our plug-in must have
spl_autoload_register(array(‘Doctrine’, ‘modelsAutoload’));
Otherwise models would not be auto-loaded, end up to ‘Class not found’ error.
Bottom entry of
http://www.doctrine-project.org/upgrade/1_2
“Models Autoloading”
seems to be it.
Unfortunately, this is not mentioned in official 1.2 documentation and I’ve spent almost 2 days.
(esp. http://www.doctrine-project.org/documentation/manual/1_2/en/introduction-to-models#autoloading-models)
hope this helps.
//
#72 by Burak on February 2nd, 2010
| Quote
I found out about this later too. But in the plugin file in this article, there is a call to the loadModels function, which will load all the model files, so you won’t get that class not found error.
You need to register modelsAutoload only when using conservative loading.
Also I found out that it doesn’t work very well when you have base classes, table classes etc.. in sub folders. The best solution might be writing a custom autoloader in that case, which is not difficult.
#73 by a.k.d. on February 3rd, 2010
| Quote
thanks for your reply.
well, let me explain what happend in my case.
I’m generating my models by invoking Doctrine_Cli, which seems to be convenient way to get model classes from YAML, without writing code
It generates model classes under APP_PATH/models and base classes under APP_PATH/models/generated.
e.g. APP_PATH/models/SimpleModel and APP_PATH/models/generated/BaseSimpleModel.
this means that generated/BaseSimpleModel.php must be loaded before loading SimpleModel.php.
However, Doctrine ‘require_once’ in aggressive mode, I get
–
Fatal error: Class ‘BaseSimpleModel’ not found in APP_PATH/models/SimpleModel.php on line 13
–
In this article, model is directly derived from Doctrine_Record and base class dependency doesn’t matter.
conservative mode and ‘modelsAutoload’ solved my problem, at least for me.
hope this helps.
thanks.
//
#74 by fpbosch on February 6th, 2010
| Quote
It drives me crazy. I tried It but I still have the same error I don’t know what can I do ? it doesn’t load my models. can you post your code of the doctrine_pi.php
#75 by a.k.d. on February 6th, 2010
| Quote
Hi.
fpbosch:
Are you using models generated by Doctrine 1.2.x in aggressive mode?
Have you tried modelsAutolod in conservative mode?
What error do you see?
Burak:
may I post whole 65 lines of modified doctrine_pi.php here for fpbosch?
thanks.
//
#76 by fpbosch on February 7th, 2010
| Quote
is it different generate models from aggressive or conservative ? I thought it was only different in the way of load it. In my doctrine_tools I created this function
public function create_models() {
Doctrine::generateModelsFromDb(APPPATH.’models’);
}
The problem is that when I call a class it doesn’t found it e.g:
Fatal error: Class ‘BaseLyProvinces’ not found in /var/www/lybica/application/models/LyProvinces.php on line 13
I don’t how to use modelsAutoload I tried this
spl_autoload_register(array(‘Doctrine’, ‘modelsAutoload’));
// we load our database connections into Doctrine_Manager
// this loop allows us to use multiple connections later on
foreach ($db as $connection_name => $db_values) {
// first we must convert to dsn format
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['username'] .
‘:’ . $db[$connection_name]['password'].
‘@’ . $db[$connection_name]['hostname'] .
‘/’ . $db[$connection_name]['database'];
Doctrine_Manager::connection($dsn,$connection_name);
}
But then I get this error:
Fatal error: Class ‘Doctrine_Manager’ not found in /var/www/lybica/application/plugins/doctrine_pi.php on line 24
I would like to see you code
Thank you a lot
#77 by fpbosch on February 7th, 2010
| Quote
ooops I’ve got it
spl_autoload_register(array(‘Doctrine’, ‘autoload’));
spl_autoload_register(array(‘Doctrine_Core’, ‘modelsAutoload’));
// we load our database connections into Doctrine_Manager
// this loop allows us to use multiple connections later on
foreach ($db as $connection_name => $db_values) {
// first we must convert to dsn format
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['username'] .
‘:’ . $db[$connection_name]['password'].
‘@’ . $db[$connection_name]['hostname'] .
‘/’ . $db[$connection_name]['database'];
Doctrine_Manager::connection($dsn,$connection_name);
}
// CodeIgniter’s Model class needs to be loaded
require_once BASEPATH.’/libraries/Model.php’;
// telling Doctrine where our models are located
Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
Doctrine::loadModels(APPPATH.’/models’);
.
.
…
Thank you!
#78 by fpbosch on February 7th, 2010
| Quote
But now it doesn’t found the Current_User class…
Fatal error: Class ‘Current_User’ not found in /var/www/lybica/application/controllers/login.php on line 65
#79 by a.k.d. on February 8th, 2010
| Quote
Do you have Current_User.php in your APPPATH/models/ directory?
In conservative mode, Doctrine assumes that file name == class name.
i.e. You need to define Current_User class in APPPATH/models/Current_User.php, otherwise it won’t get autoloaded.
thanks.
//
#80 by Anuraag on August 28th, 2010
| Quote
I had the same problem – that the Base class was not being loaded with a fatal Error.
In my case it got fixed by adding following lines in doctrine_pi.php – before Doctrine::loadModels –
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
#81 by Firman Nugraha on February 2nd, 2010
| Quote
Hello Mr. Burak, I just finished reading and practicing this tuturial. I’m heavily impressed with the way of how you write the tutorial and how you create the examples.
If possible, can I translate your tutorial to my native language which is Indonesian and post it in my blog? And of course with crediting you. I believe this will help my fellow Indonesian developers who don’t have much skill in English.
#82 by Burak on February 2nd, 2010
| Quote
Yes, you may do that
#83 by aan on October 9th, 2010
| Quote
hello, i am from indonesia too, and really like your tuts. may i copas your doctrine_pi.php code to my blog post? thank you, sorry if my english is not good
#84 by Jesse Schutt on February 3rd, 2010
| Quote
Hello Burak
Thanks for walking us through this process!
I’m getting an error that I was hoping you could help with. When I load http://localhost:8888/ci_doctrine_day_1 I get the following error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: root
Filename: plugins/doctrine_pi.php
Line Number: 17
A PHP Error was encountered
Severity: Notice
Message: Undefined index: root
Filename: plugins/doctrine_pi.php
Line Number: 18
A PHP Error was encountered
Severity: Notice
Message: Undefined index: localhost
Filename: plugins/doctrine_pi.php
Line Number: 19
A PHP Error was encountered
Severity: Notice
Message: Undefined index: ci_doctrine
Filename: plugins/doctrine_pi.php
Line Number: 20
When I try to load the hello/world or the hello/user_test, I just get a blank page. Any ideas?
Thanks again!
#85 by Burak on February 6th, 2010
| Quote
I’m not sure. Something might be wrong with the $db array in your config/database.php file.
#86 by a.k.d. on February 8th, 2010
| Quote
Do you have Current_User.php in your APPPATH/models/ directory?
In conservative mode, Doctrine assumes that file name == class name.
i.e. You need to define Current_User class in APPPATH/models/Current_User.php, otherwise it won’t get autoloaded.
thanks.
//
#87 by a.k.d. on February 8th, 2010
| Quote
oops, sorry for this.
I see no ‘reply’ link to fpbosch’s replies …
//
#88 by Mark on February 11th, 2010
| Quote
So I’ve worked with Doctrine just a bit, and using their autogenerating methods, you get a the following file layout
Models
- generated (folder)
- – BaseCity.php (this extends the doctrine record class)
- city.php ( extends basecity )
All of the custom/override methods go in city.php and table definitions/relationships go into basecity.php. Curious where you would override methods add custom methods to your model. Would it be in the same model file?
#89 by Burak on February 13th, 2010
| Quote
The auto-generated city.php file is mostly blank right? I would put the custom methods there. So Basecity.php just remains for defining the table structure.
If you don’t want this separation, you can tell Doctrine to not generate base class files. There is an option for it.
#90 by Didin Wahyudin on February 14th, 2010
| Quote
i am using WAMP, when i tried your 1st tutorial, then i browse http://localhost/doctrine/index.php/hello/user_test, i getting this error:
Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘PDO Connection Error: SQLSTATE[28000] [1045] Access denied for user ‘roor’@'localhost’ (using password: NO)’ in G:\web\doctrine\system\application\plugins\Doctrine\lib\Doctrine\Connection.php:474 Stack trace: #0 G:\web\doctrine\system\application\plugins\Doctrine\lib\Doctrine\Connection\Mysql.php(101): Doctrine_Connection->connect() #1 G:\web\doctrine\system\application\plugins\Doctrine\lib\Doctrine\Connection\UnitOfWork.php(54): Doctrine_Connection_Mysql->connect() #2 G:\web\doctrine\system\application\plugins\Doctrine\lib\Doctrine\Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3 G:\web\doctrine\system\application\controllers\hello.php(17): Doctrine_Record->save() #4 [internal function]: Hello->user_test() #5 G:\web\doctrine\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #6 G:\web\doctrine\index.php(115): require_once(‘G:\web\doctrine…’) #7 {main} thrown in G:\web\doctrine\system\application\plugins\Doctrine\lib\Doctrine\Connection.php on line 474
how to resolve this problem. Sorry, bad english.
#91 by Burak on February 15th, 2010
| Quote
Did you put “roor” for the database username instead of “root” ?
#92 by Didin Wahyudin on February 16th, 2010
| Quote
oo.. i see, thank you. Sorry for my idiot.
#93 by Dirk Franssen on February 16th, 2010
| Quote
Great series!
I have a doctrine class A extends B.
But I get a Fatal error: Class ‘B’ not found in … A.php
How to make sure B is also autoloaded while A gets autoloaded?
Thanks in advance
#94 by Dirk Franssen on February 16th, 2010
| Quote
Found it. These changes are working for me:
spl_autoload_register(array(‘Doctrine’, ‘autoload’));
spl_autoload_register(array(‘Doctrine’, ‘modelsAutoload’));
Doctrine_Core::setModelsDirectory(APPPATH.’/models’); //instead of loadModels
Doctrine_Manager::getInstance()->setAttribute(‘model_loading’, ‘aggressive’);
#95 by Ned on February 16th, 2010
| Quote
Hi,
i have a problem.
In page :
http://localhost/ci_doctrine_day1/index.php/hello/world
i get a message:
Unable to load the requested file: plugins/doctrine_pi.php
What can i solve this problem?
Thanks in advance.
#96 by Habib BULUT on February 18th, 2010
| Quote
Burak ellerine saglik kardesim :] cok kaliteli bir dokuman
Pingback: CodeIgniter- Doctrine ORM Tutorial: A way of enhancing CI | TheUnical Technologies Blog
#97 by zeeshaan on March 9th, 2010
| Quote
Fatal error: Uncaught exception ‘Doctrine_Connection_Mysql_Exception’ with message ‘SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘ci_doctrine.user_model’ doesn’t exist’ in C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection.php:1082 Stack trace: #0 C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection\Statement.php(269): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement)) #1 C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1042): Doctrine_Connection_Statement->execute(Array) #2 C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection.php(687): Doctrine_Connection->exec(‘INSERT INTO use…’, Array) #3 C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(631): Doctrine_Connection->insert(Object(Doctrine_Table), Array) #4 C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(562): Doctrine_Connecti in C:\xampp\htdocs\system\application\plugins\doctrine\lib\Doctrine\Connection.php on line 1082 –
error -pls help
#98 by zeeshaan on March 10th, 2010
| Quote
ok.. my model name was diff from my table name … so just added “$this->setTableName(‘user’); ” .. SOLVED!
#99 by papse on March 17th, 2010
| Quote
Thanks very , very , very ………. for this titorial
You are save my life
the world is running with your help
Also thanks very much !!!!!!!!!!!!!!!
#100 by papse on March 19th, 2010
| Quote
Hello everybody, I start by thank you for this tutorial
I have a question
If my table has a varchar type as a primary key ; how I define my model et how I configure my doctrine_pi.php file ?
my table is like this
create table Employee
(
idoperateur varchar(254) not null,
name varchar(254),
firstname varchar(254),
speciality varchar(254),
levelaccess int,
primary key (idoperateur)
);
Also thanks for any answer
excuse me for my english
#101 by keded on March 30th, 2010
| Quote
I am Having a similar problem.
I have an existing (mysql) database which I am trying to connect to, however I notice that the doctrine_pi.php creates a integer primary key which I commented out.
However it generates an error because the Doctrine “UnitOfWork.php” is looking for some ID field
This is my second day at CodeIgniter and Doctrine… So this is all new to me, but your tutorial thus far really serves as a great introduction
#102 by San on March 23rd, 2010
| Quote
Type your comment here
#103 by Gaurav on March 23rd, 2010
| Quote
Hello all,
I am a problem when i migrated my ci and doctrine stuff from localhost(on xampp running php5.3) to a server running 5.2. I made appropriate changes to database settings and base url and can see that the controller and views are loading. However, i am unable to save rows into tables that represent the models.. I have exported my entire database from localhost but still cant see inserts….have tried everything but cant get it to work it just hangs before the save() function call to insert records.
Any help us appreciated.
#104 by Daryl Wood on March 24th, 2010
| Quote
Hello Burak,
I followed your instruction to put this “extension=php_pdo_mysql.dll” into my php.ini file, and it didn’t help with the following error:
Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘Couldn’t locate driver named mysql’ in C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php:486 Stack trace: #0 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\Mysql.php(101): Doctrine_Connection->connect() #1 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(54): Doctrine_Connection_Mysql->connect() #2 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3 C:\inetpub\wwwroot\ci_doctrine_day1\system\application\controllers\hello.php(17): Doctrine_Record->save() #4 [internal function]: Hello->user_test() #5 C:\inetpub\wwwroot\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #6 C:\inetpub\wwwroot\ci_doctrine_day1\index.php(115): require_once(‘C:\ in C:\inetpub\wwwroot\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php on line 486
Any other ideas I might try?
#105 by Burak on March 24th, 2010
| Quote
Did you restart your web server after you made that change?
I can’t think of anything else. The error just says you don’t have the mysql driver enabled, and Doctrine uses PDO.
Pingback: CodeIgniter und Doctrine « Blog von Christian Fritsch
#106 by David on April 1st, 2010
| Quote
Hi
for conservative mode, add in doctrine_pi.php
// Conservative mode
Doctrine_Manager::getInstance()->setAttribute(‘model_loading’, Doctrine::MODEL_LOADING_CONSERVATIVE);
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, TRUE);
before :
// telling Doctrine where our models are located
Doctrine::loadModels(APPPATH.’/models’);
Doc. say : Conservative model loading is recommended in most cases, specifically for production
environments as you do not want to require every single model class even when it is not
needed as this is unnecessary overhead. You only want to require it when it is needed.
#107 by David on April 1st, 2010
| Quote
Forgot to say : thank you
#108 by Stephen on April 6th, 2010
| Quote
I am new to CodeIgnitor, I followed following steps as mentioned in this tutor
a) Downloaded CodeIgnitor 1.7.2
b) copied it to C:\Inetpub\wwwroot\ci_doctrine_day1.
c) I am able to see welcome page when l Launch in IE
http://localhost/ci_doctrine_day1/
d) Created a new php file hello.php under controller directory of application folder.
e) Created a class called Hello and function called world
as mentioned in i wrote echo statement to print hello codeignitor.
f) Launching following path http://localhost/ci_doctrine_day1/index.php/hello/world
Throw The page cannot be found HTTP 404 – File not found error.
Please let me know what I am missing here.
I have PHP 5 in my machine.
#109 by Stephen on April 6th, 2010
| Quote
http://localhost/ci_doctrine_day1/index.php?hello/world
adding ? after index.php instead of / solved my problem. But can someone expalain me why I need to put ? Is there a way to avoid it.
#110 by fleacool on April 16th, 2010
| Quote
Hi bro..
I trying this tutorials in localhost and I got errors
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: dsn
Filename: plugins/doctrine_pi.php
Line Number: 24
please help me for fix this problem
thanks b4
#111 by Anthony on April 19th, 2010
| Quote
Thanks for the tutorials. They are very helpful.
Unfortunately, I am getting this error message: Fatal error: Class ‘User’ not found in C:\xampp\htdocs\ci_doctrine_day1\system\application\controller\hello.php on line 17. Line 17 is “$u = new User;”
Any idea what is causing this problem?
#112 by Anthony on April 19th, 2010
| Quote
FOUND CAUSE OF ERROR:
Re: Fatal error: Class ‘User’ not found….
I forgot to autoload doctrine in in system/application/config/autoload.php
Works great now.
#113 by Gomby on April 20th, 2010
| Quote
Fantastic series, just continue it. More and more professional details. THX.
#114 by Spinatch on April 22nd, 2010
| Quote
Hello y’all!
For all of you out there who might want to use CI with Doctrine and an Oracle database, here’s a tip.
My Doctrine wouldn’t work with the way Burak constructed the $dsn -it would not connect/find the oracle database.
Here’s what finally worked for me:
I had to replace the code inside of the foreach in the plugin config file
foreach ($db as $connection_name => $db_values) {
$dsn = ‘oracle:dbname=SRVNAME;charset=AL328TF8′;
$adapter = new Doctrine_Adapter_Oracle($dsn, $db[$connection_name]['username'], $db[$connection_name]['password']);
Doctrine_Manager::connection($adapter, $connection_name);
}
Apparently, this works fine.
Thanks again for a great series and good luck to everyone!
S
#115 by Sean Martin on April 22nd, 2010
| Quote
Thanks for these great tutorials!
I noticed that CodeIgniter 2.0 is on the horizon and that plugins are going to be removed. http://philsturgeon.co.uk/news/2010/03/codeigniter-2
What do you think would be the best way to set up Doctrine with CI 2.0 based on that?
#116 by Burak on April 22nd, 2010
| Quote
It can be installed in any folder you want and be loaded with a custom hook. I have done that for another project.
#117 by Herbert on April 23rd, 2010
| Quote
First question is if i extract lib folder it shows lib/Doctrine/lib.php (then i rename lib.php to doctrine.php – is this correct?)
Then all steps went fine until at user_test error below:
Severity: Notice
Message: Use of undefined constant doctrine – assumed ‘doctrine’
Filename: config/autoload.php
Line Number: 66
Fatal error: Uncaught exception ‘LogicException’ with message ‘Passed array does not specify an existing static method (class ‘Doctrine’ not found)’ in C:\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine_pi.php:11 Stack trace: #0 C:\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine_pi.php(11): spl_autoload_register(Array) #1 C:\wamp\www\ci_doctrine_day1\system\libraries\Loader.php(466): include_once(‘C:\wamp\www\ci_…’) #2 C:\wamp\www\ci_doctrine_day1\system\libraries\Loader.php(968): CI_Loader->plugin(Array) #3 C:\wamp\www\ci_doctrine_day1\system\libraries\Controller.php(83): CI_Loader->_ci_autoloader() #4 C:\wamp\www\ci_doctrine_day1\system\libraries\Controller.php(43): Controller->_ci_initialize() #5 C:\wamp\www\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(201): Controller->Controller() #6 C:\wamp\www\ci_doctrine_day1\index.php(115): require_once(‘C:\wamp\www\ci_…’) #7 {main} thrown in C:\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine_pi.php on line 11
Pingback: Best Tutorials for Web Development » Blog Archive » CodeIgniter and Doctrine from scratch. Day 10 – Pagination
Pingback: Best Tutorials for Web Development » Blog Archive » CodeIgniter and Doctrine from scratch. Day 11 – Record Hooks
#118 by fandi rahmawan on May 5th, 2010
| Quote
Hi..
I trying this tutorials in localhost and I got errorsFatal error:
Uncaught exception ‘Doctrine_Record_UnknownPropertyException’ with message ‘Unknown record property / related component “username” on “User”‘ in C:\xampp\htdocs\ci_doctrine\system\application\plugins\doctrine\lib\Doctrine\Record\Filter\Standard.php:44
Any idea what is causing this problem?
#119 by Herbert on May 5th, 2010
| Quote
Hi Burak,
Any solution to my problem? Please see post #110 April 23rd.
#120 by endless beginning on May 11th, 2010
| Quote
Nice tutorial. I just successfully completed the day 1 tutorial and it rocks. I was having much trouble setting up the doctrine. Thanks a lot for sharing such a tutorial..
#121 by Simon Hayward on May 15th, 2010
| Quote
Hello – I’m having the same error as post #111. I have tested this and it works fine locally on MAMP, but when I upload to my Linux server, I get the same error:
Fatal error: Uncaught exception ‘Doctrine_Record_UnknownPropertyException’ with message ‘Unknown record property / related component “first_name” on “User”‘ in /blah/blah/public_html/application/plugins/doctrine/lib/Doctrine/Record/Filter/Standard.php:44 Stack trace: #0 /blah/blah/public_html/application/plugins/doctrine/lib/Doctrine/Record.php(1395): Doctrine_Record_Filter_Standard->filterSet(Object(User), ‘first_name’, ‘John’) #1 /blah/blah/public_html/application/plugins/doctrine/lib/Doctrine/Record.php(1346): Doctrine_Record->_set(‘first_name’, ‘John’, true) #2 /blah/blah/public_html/application/plugins/doctrine/lib/Doctrine/Access.php(60): Doctrine_Record->set(‘first_name’, ‘John’) #3 /blah/blah/public_html/application/controllers/hello.php(15): Doctrine_Access->__set(‘first_name’, ‘John’) #4 /blah/blah/public_html/system/codeigniter/CodeIgniter.php(236): Hello->user_test() #5 /blah/blah/public_html/index.php(115): require_once(‘/blah/blah/pub…’) #6 {main} thrown in /blah/blah/public_html/application/plugins/doctrine/lib/Doctrine/Record/Filter/Standard.php on line 44
Any ideas?
Thanks
#122 by iain on May 21st, 2010
| Quote
Hi,
Great tutorial. Maybe this will help someone though… in the doctrine_pi.php file I had to change this line (5):
require_once APPPATH.’/plugins/doctrine/lib/Doctrine.php’;
to:
require_once BASEPATH.’/plugins/doctrine/lib/Doctrine.php’;
as my plugins path was actually “/system/plugins” and not “/system/application/plugins”
Thanks Burak, good work
#123 by ren on May 26th, 2010
| Quote
nice tutorial………….
Great work
Pingback: Top 20 MySQL Best Practices
Pingback: CodeIgniter + Zend Library + Doctrine = doCEND | fclose
#124 by Tahsin Hasan on June 1st, 2010
| Quote
hi,
Great tutorial, but i want to use hmvc modular extension with doctrine in codeigniter. how can I do so?
You can find helpful topics on newdailyblog.blogspot.com.
Pingback: Integrando o CodeIgniter com o Doctrine | ASNeto
#125 by Ben on June 9th, 2010
| Quote
Hi.. this is a great tut.. but i have a problem here..
Fatal error: Uncaught exception ‘Doctrine_Record_UnknownPropertyException’ with message ‘Unknown record property / related component “save” on “User”‘ in C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record\Filter\Standard.php:55 Stack trace: #0 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1382): Doctrine_Record_Filter_Standard->filterGet(Object(User), ‘save’) #1 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1337): Doctrine_Record->_get(‘save’, true) #2 C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Access.php(72): Doctrine_Record->get(‘save’) #3 C:\AppServ\www\ci_doctrine_day1\system\application\controllers\hello.php(15): Doctrine_Access->__get(‘save’) #4 C:\AppServ\www\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(236): Hello->user_test() #5 C:\AppServ\www\ci_doctrine_day1\index.php(115): require_once(‘C:\AppServ\www\…’) #6 {main} thrown in C:\AppServ\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record\Filter\Standard.php on line 55
#126 by Çağdaş on June 9th, 2010
| Quote
Great work Burak!!
i have a situation with doctrine paths i think.
you know this err occured before:
Fatal error: Class ‘User’ not found in C:\Program Files\EasyPHP 3.0\www\day1\system\application\controllers\hello.php on line 12
i still coulnt get over it. any help is appreciated. thanks..
#127 by Steven on June 18th, 2010
| Quote
I had the same error and it was a stupid mistake i made.
I added
$autoload['plugin'] = array(‘doctrine’);
somewhere in the beginning of the autoload file, not realising there was allready one on line 66:
$autoload['plugin'] = array(”);
that was overwriting it.
Hope this helps
#128 by fbUser on June 10th, 2010
| Quote
I’ll try to use firebird driver but error. can you help me? thx be4
#129 by Steffen on June 16th, 2010
| Quote
Hi to everyone
I got some local problems with the utf8 charset encoding in my html output.
(PHP 5.3.1, MySQL 5.1.41)
I made the following changes to the doctrine_ci.php:
$conn = Doctrine_Manager::connection($dsn,$connection_name);
$conn->setCharset(‘utf8′);
$conn->setCollate(‘utf8_general_ci’);
Now everything works fine for me.
Is there maybe a better solution?
Does this solution work for multiple database connections?
Cheers
Steffen
PS: Great tutorial !!
#130 by Suseno on June 20th, 2010
| Quote
hai mr. burak
i’m is problem in
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in D:\AppServ\www\suse\system\plugins\doctrine_pi.php on line 35
$db_values) {
// first we must convert to dsn format
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['username'] .
‘:’ . $db[$connection_name]['password'].
‘@’ . $db[$connection_name]['hostname'] .
‘/’ . $db[$connection_name]['database'];
Doctrine_Manager::connection($dsn,$connection_name);
}
// CodeIgniter’s Model class needs to be loaded
require_once BASEPATH.’/libraries/Model.php’;
// telling Doctrine where our models are located
Doctrine::loadModels(APPPATH.’/models’);
// (OPTIONAL) CONFIGURATION BELOW
// this will allow us to use “mutators”
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
// this sets all table columns to notnull and unsigned (for ints) by default
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_COLUMN_OPTIONS,
array(‘notnull’ => true, ‘unsigned’ => true));
// set the default primary key to be named ‘id’, integer, 4 bytes
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
array(‘name’ => ‘id’, ‘type’ => ‘integer’, ‘length’ => 4));
//////////////////////////////
autoload.php
/////////////////////////////
because when I change autoload.php
$autoload['plugin'] = array(‘doctrine’);
#131 by Burak on June 21st, 2010
| Quote
Are you running PHP 4? This requires PHP 5.2.3+
#132 by Marcin on June 22nd, 2010
| Quote
Really great tutorial, thank you!
#133 by Steve Wanless on June 23rd, 2010
| Quote
Hi, Can you help with an error I am getting in doctrine_pi.php
Fatal error: Undefined class constant ‘ATTR_AUTO_ACCESSOR_OVERRIDE’ …
If I comment out the section below “(OPTIONAL) CONFIGURATION BELOW” it mostly works but fails when I tried to use a mutator (as I expected it would).
Otherwise it seems to be working fine for me on PHP 5.2.13
Would this be a PHP version problem? Do I specifically need 5.2.3 for all of this to work?
#134 by Vinícius on June 29th, 2010
| Quote
Hello, congratz for the great tutorial!
But it’s still not clear in my mind why doctrine is better than CI Active Record native class, what kind of limited functionalities you mean?
Thanks!
#135 by John on July 6th, 2010
| Quote
Hi Burak,
Does this work with doctrine2? Or do you have any plans to update the series if not?
Thanks!
#136 by ajaz ali on July 9th, 2010
| Quote
there should be a proper error msg displayed if we try to insert duplicate value for unique column like usernme in first practice of crash course
#137 by Dean on July 9th, 2010
| Quote
Love the tutorial! I just have one problem: Is there any possible way to get Doctrine to work with a unix socket other than going in and hacking the Doctrine files?
For example, my host requires that I connect to my databases by using this: localhost:/tmp/mysql5.sock
This causes issues with Doctrine in the Connection.php file. I’ve tried mapping out the socket in both the php.ini file and .htaccess file, but this doesn’t work. Do you have any suggestions, please?
#138 by Antonio on July 19th, 2010
| Quote
@Dean
Instead of using localhost, try:
$db['default']['hostname'] = “127.0.0.1″;
inside your database.php config file.
#139 by Faz on August 18th, 2010
| Quote
Great series Burak!, I have managed to do my own little site using CI with doctrine now, however I developed it on wamp on my local machine but need to host it on a linux red hat environment
When I transferred my project (setup as is on WAMP) to LAMP my site does not display at all. I just get a blank page
no errors showing even if I try going to different url paths, removed htaccess to elimate that as a problem still nothing displays, I get the feeling my models are not being loaded or there is no database connection being made at all?
Is there something I need to set up differently for doctrine/ci to work on linux? Also my hosting server only has PHP 5.2.13 not 5.2.3 as stated on doctrine but this doesnt seem to matter on my local machine which is using 5.2.11?
Any help/suggestions would be greately appreciated
Thanks
#140 by Faz on August 18th, 2010
| Quote
Still trying to figure out what is going wrong its seems like my project is not calling the plugins/doctrine_pi.php file at all, by simple debugging I can see the config/database.php is also not called
Can I force this somehow in Linux?
#141 by Rafael Monroy on February 28th, 2011
| Quote
Connection Error on Unix Socket
#142 by Rafael Monroy on February 28th, 2011
| Quote
http://www.doctrine-project.org/jira/browse/DC-50
#143 by Rafael Monroy on March 1st, 2011
| Quote
http://drakkaroy.org/2011/03/conexion-codeigniter-y-doctrine-en-unix-con-mysql/
Pingback: Boozox » 20 Consejos para Mejorar tu MySQL que quizás no conocías
#144 by Oli on August 23rd, 2010
| Quote
PDO is enable and i have the following message. (I’m running on Vista)
Fatal error: Uncaught exception ‘Doctrine_Manager_Exception’ with message ‘Could not parse dsn’ in D:\wamp\www\POOL_CI\system\application\plugins\doctrine\lib\Doctrine\Manager.php:419 Stack trace: #0 D:\wamp\www\POOL_CI\system\application\plugins\doctrine\lib\Doctrine\Manager.php(434): Doctrine_Manager->_buildDsnPartsArray(‘://root:@localh…’) #1 D:\wamp\www\POOL_CI\system\application\plugins\doctrine\lib\Doctrine\Manager.php(304): Doctrine_Manager->parseDsn(‘://root:@localh…’) #2 D:\wamp\www\POOL_CI\system\application\plugins\doctrine\lib\Doctrine\Manager.php(266): Doctrine_Manager->openConnection(‘://root:@localh…’, ‘default’) #3 D:\wamp\www\POOL_CI\system\application\plugins\doctrine_pi.php(24): Doctrine_Manager::connection(‘://root:@localh…’, ‘default’) #4 D:\wamp\www\POOL_CI\system\libraries\Loader.php(466): include_once(‘D:\wamp\www\POO…’) #5 D:\wamp\www\POOL_CI\system\libraries\Loader.php(968): CI_Loader->plugin(Array) #6 D:\wamp\www\POOL_CI\system\libraries\Controller.php(83): CI_Loader->_ci_autoloader() in D:\wamp\www\POOL_CI\system\application\plugins\doctrine\lib\Doctrine\Manager.php on line 419
#145 by iyas on August 27th, 2010
| Quote
Thanks Burak….i am inspired by you.. You are a good programmer and writer. It very exciting to follow your tutorial. I am not just learning CI and Doctrine but also how to write tutorial….
THANKS
#146 by Paul on August 31st, 2010
| Quote
I know I must be blind and/or stupid, but when I download Doctrine I don’t have a lib folder. I have a folder Doctrine-1.2.3 with Doctrine.php and a folder called Doctrine inside it. There’s no folder “lib” inside there.
#147 by Burak on August 31st, 2010
| Quote
Looks like things changed in the new Doctrine version. Just create the lib folder yourself, and put the Doctrine folder and Doctrine.php in it.
#148 by Paul on August 31st, 2010
| Quote
Hi Burak,
thanks for that!
I’ve just installed Doctrine in CI and created the user model and the hello controller. However, when I call it (example.com/ci/index.php/hello/world) it gives me an error:
“Message: require_once(/home/paul/Projekte/example.com/ci/system/application//plugins/doctrine/lib/Doctrine.php) [function.require-once]: failed to open stream: No such file or directory
Filename: plugins/doctrine_pi.php
Line Number: 5″
So in the file doctrine_pi.php I changed the paths that use APPPATH to:
require_once APPPATH.’config/database.php’;
(line 5) require_once APPPATH.’../plugins/doctrine/lib/Doctrine.php’;
(line
(line 31) Doctrine::loadModels(APPPATH.’models’);
Now when I call example.com/ci/index.php/hello/world it gives me no error message, only the expected “Hello CodeIgniter!”.
Then when I call example.com/ci/index.php/hello/user_test I get:
“A PHP Error was encountered
Severity: Warning
Message: PDO::__construct() [pdo.--construct]: [2002] Invalid argument (trying to connect via unix://)
Filename: Doctrine/Connection.php
Line Number: 470″
I checked and it seems it has something to do with the $dsn array in doctrine_pi.php.
So I went and gave it the MySQL info that I use for my CI project:
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['root'] .
‘:’ . $db[$connection_name][''].
‘@’ . $db[$connection_name]['localhost'] .
‘/’ . $db[$connection_name]['ci_linksdir'];
But then I get these errors:
“A PHP Error was encountered
Severity: Notice
Message: Undefined index: root
Filename: plugins/doctrine_pi.php
Line Number: 19
A PHP Error was encountered
Severity: Notice
Message: Undefined index:
Filename: plugins/doctrine_pi.php
Line Number: 20
A PHP Error was encountered
Severity: Notice
Message: Undefined index: localhost
Filename: plugins/doctrine_pi.php
Line Number: 21
A PHP Error was encountered
Severity: Notice
Message: Undefined index: ci_linksdir
Filename: plugins/doctrine_pi.php
Line Number: 22″
I am at my wits end lol.
#149 by Paul on September 1st, 2010
| Quote
I did what was suggested in #40 (http://www.phpandstuff.com/articles/codeigniter-doctrine-from-scratch-day-1-install-and-setup/comment-page-1#comment-658) and now the errors are gone.
#150 by Nimesha on September 9th, 2010
| Quote
This post is great.. There are only small issues I had to fix. Anyway thank you very much..
#151 by drakkar on September 10th, 2010
| Quote
“By default, Doctrine will look for a table with same name as the class. In this case: “user”. (this can be changed)”
I need change this, helpme please !
#152 by Edtek on September 11th, 2010
| Quote
Hi Burak,
Thanks for this wonderful tutorials.I’ve got some problem here
http://www.gardencitylions.org/gallery/
i am experiencing this error
Unable to load the requested class: categoriesdao
i’ve done everything i know but to no avail.Could you please help me out?
Thanks very much!!
#153 by Edtek on September 11th, 2010
| Quote
Hi Burak,
It is me again.i forgot to give you this information.the site works very well on my system.i am using windows xp with PHP 5.3.3 but when i uploaded the site onto my shared remote host that page in particular does not work at all.I have everything i know of..
Please help me out.
#154 by Niraghuana on September 13th, 2010
| Quote
Hi Edtek,
which version of CI and Doctrine do you use?
Where did you find the “lib” folder mentioned above?
I just downlaoded DoctrineCommon-2.0.0RC1 but can not find the lib folder.
If anybody else could help me out, just give me a hint
Thank you very much.
#155 by Niraghuana on September 13th, 2010
| Quote
Oh sorry for that. I just saw somebody else had the same problem. I will try to manage it like he did.
Thanks.
#156 by vetabz on September 16th, 2010
| Quote
Hi…
this is a very good tutorial…. can you please help me with this error?
Fatal error: Uncaught exception ‘Doctrine_Transaction_Exception’ with message ‘Rollback failed. There is no active transaction.’ in /home/a1647399/public_html/system/application/plugins/doctrine/lib/Doctrine/Transaction.php:319 Stack trace: #0 /home/a1647399/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection.php(1426): Doctrine_Transaction->rollback(NULL) #1 /home/a1647399/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(136): Doctrine_Connection->rollback() #2 /home/a1647399/public_html/system/application/plugins/doctrine/lib/Doctrine/Record.php(1599): Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3 /home/a1647399/public_html/system/application/controllers/hello.php(17): Doctrine_Record->save() #4 /home/a1647399/public_html/system/codeigniter/CodeIgniter.php(236): Hello->user_test() #5 /home/a1647399/public_html/index.php(115): require_once(‘/home/a1647399/…’) #6 {main} thrown in /home/a1647399/public_html/system/application/plugins/doctrine/lib/Doctrine/Transaction.php on line 319
thanks a lot….
#157 by vetabz on September 17th, 2010
| Quote
Hello Again I’m sorry I didn’t mention this but that error was when I try to run user_test as so:
http://localhost/index.php/hello/user_test
anyway…. I already found out what the problem is… it is jus the PDO MySQL Driver which is disabled. It just needs to be enabled.
Thanks… Moving on to the next!
Pingback: How to Run Doctrine ORM with CodeIgniter | TalkWeb
#158 by Sandro on September 20th, 2010
| Quote
Hi, I’m using a windows host but got an error from PDO Access Denied … but if I do the mysql connection using mysql_connect the connection is made.
any ideas ?
thanks and great tutorial. this one saved my life on the beginning.
#159 by Les on September 25th, 2010
| Quote
Hi Burak.
Thanks for the step-by-step intro which is a real big help to someone new to both CI and Doctrine, such as myself.
I had one question: what extra steps would I need to carry out in order to be able to access the Doctrine command line interface? Not sure if it matters but my set-up is Windows7 + WAMP + Codeigniter 1.7.2 +Doctrine 1.2.3
Thanks again.
#160 by Les on September 25th, 2010
| Quote
A further comment, if I may.
I went a step further and used Doctrine to generate the model classes from an existing database.
To do this I simply added Doctrine::generateModelsFromDb(APPPATH.’/models’); to a new action function in the Hello controller. And sure enough, lo and behold, when I ran hello/genmodels there were all my model classes (one for each table in my db) under application/models and application/models/generated
However, at this point my project broke. Running the simple hello/world example threw up this error:
Fatal error: Class ‘BaseCategory’ not found in C:\wamp\www\ci172\system\application\models\Category.php on line 14
(One of my tables is called category.)
After some searching around, and trial and error, I changed this line in application/plugins/doctrine/lib/Doctrine/Import/Builder.php:
protected $_baseClassesDirectory = ”; //was ‘generated’ before
This made the error go away and restored things back to normal, after I deleted and regenerated my model classes, obviously.
Question is: did I go about this the right way, or was there a better way to solve this error?
Thanks again.
Pingback: Codeigniter: Aprenda de graça com os melhores tutorias « Blog do Alphabraga
#161 by Jarrod on September 30th, 2010
| Quote
Thanks for a fantastic set of tutorials.
I’m getting some strange text at the top of every page when viewed in Safari and Chrome (see below).
Mac OS X 2°âATTR9ùx✜com.apple.TextEncodingmacintosh;0This resource fork intentionally left blank ÿÿMac OS X 2°âATTRÝÚ‚¯âœœcom.apple.TextEncodingmacintosh;0This resource fork intentionally left blank ÿÿMac OS X 2°âATTR\–lò✜com.apple.TextEncodingmacintosh;0This resource fork intentionally left blank ÿÿMac OS X 2°âATTRIäÇ✜com.apple.TextEncodingmacintosh;0This resource fork intentionally left blank ÿÿ
I can;t seem to find any mention of this issue here other than one comment post that said something about making changes to doctrine_pi.php but that fix didn’t seem to do anything.
Any ideas?
Pingback: Codeigniter untuk pemula, eps 3 « Ainggoblog’s Blog
#162 by Ramseize on October 13th, 2010
| Quote
one of best tutorials i have read… its also my first learning doctrine.
Pingback: Misty-Stix - Codeigniter-Doctrine migration from Windows to Linux - Misty-Stix
#163 by Amit on October 16th, 2010
| Quote
One of the better tutorials definitely. Being a newbie to PHP and of course doctrine and code ignitor, I was able to follow the tutorial intitutively, except for one instance, configuring Doctrine to connect to the actual mysql db. Using the steps defined above I couldnt connect to the DB and kept getting exception – Message: PDO::__construct() [pdo.--construct]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock).
The only was I able to get around the problem was using the following statement for creating connection using Doctrine_Manager –
Doctrine_Manager::connection(‘mysql://phpuser:password@127.0.0.1/learning_php’,'doctrine_conn1′);
which does not make sense.
Any help or insight will be highly appreciated.
BTW – apachectl -v => 2.2.14; php -v => 5.3.2; Doctrine => 1.2.3 and CodeIgnitor => 1.7.2
#164 by Amit on November 26th, 2010
| Quote
I figured out a better solution to this issue –
Execute netstat -ln | grep mysql to figure the sock file path on mysql server. We will use the path to edit database.php
Edit ‘database.php’ file to include another property to db array as follows –
$db['default']['unix_socket'] = “/tmp/mysql.sock”;
use this while creating dsn before passing it to Doctrine_Manager to create connection as follows –
$dsn = $db[$connection_name]['dbdriver'] .
‘://’ . $db[$connection_name]['username'] .
‘:’ . $db[$connection_name]['password'].
‘@’ . $db[$connection_name]['hostname'] .
‘/’ . $db[$connection_name]['database'].
‘;unix_socket=’ . $db[$connection_name]['unix_socket'];
#165 by rahul on October 19th, 2010
| Quote
I tried to run the URL for doctrine and i get this error..please help
Fatal error: Class ‘User’ not found in /home1/rahulurs/public_html/code/system/application/controllers/hello.php on line 12
#166 by Nermin on October 19th, 2010
| Quote
Just heads up, if you get this:
PDO Connection Error: SQLSTATE[28000] [1045] Acess denied to ‘root’@'localhost’ (using password: YES)
and you are 100% sure you have correct user and password, you may want to take out any “+” in your password out, it turns out that Doctrine changes them, so when it submits your password to mysql, password is no longer the same…
I found the solution here, once I updated the password I could continue with this
http://trac.symfony-project.org/ticket/6923
Also I would like to thank the author for taking the time to write this tutorial.
Btw question for the author: what are your thoughts on codeigniter 2.0 they removed the plugins it seems, will it be hassle to addopt Doctrine to CI2…
And also one question regarding the new releases of Doctrine, have you had chance to take a look and see how they may work with CI2? I’ve noticed in latest beta they have lots of new folders. Are there any benefits to using Doctrine 2.0 when its stabilized over using Doctrine 1.2.3
Would be greatfull for your thoughts on this.
#167 by Erik on October 27th, 2010
| Quote
Hey Burak, love your CI series
This Doctrine stuff looks very nice so I’ll be taking a swing at this particular series about it.
Just as Nermin asked concerning the upcoming CI2… would it be difficult implementing Doctrine as a library instead of a plugin? (yeah that’s a hint for a quick tutorial or maybe a partial rewrite of this first part ^^)
Anyway keep up the good work
#168 by Maverickag on October 30th, 2010
| Quote
Hi Burak,
Nice tutorial!
I’m just unable to get doctrine working with it, otherwise everything is working fine.
Actually when I follow each and every step of the above tutorial and then visit http://localhost/ci_doctrine_day1/index.php/hello/user_test, I get a blank page (Yes, even adding echo statements in the beginning of user_test() doesn’t help). Not only that, even the page …./hello/world doesn’t display anything now (which was working earlier)!!
While I was trying to figure out what the problem is, I removed ‘doctrine’ from autoload.php so it now becomes
$autoload['plugin'] = array();
On doing this, at least my /hello/world is again working and even the echo statement placed in user_test() is also working, but the “two users” are not added, which is quite obvious. So, it looks like the problem is in loading of doctrine plugin…not sure though. Do you have any idea of what should I try to get rid of this problem?
Thanks in advance..
#169 by Jeroen on December 24th, 2010
| Quote
Same problem,
This tutorial is written a year ago or so, it seems that there is some sort of versioning problem going on. Note that the latest Doctrine version is 2.0 and the one used in this tut 1.1.4 (Doctrine.php). Same goes for Ci I guess.
Hope it is just something small, dying to check out full series!
#170 by mo2men on October 30th, 2010
| Quote
hey
- about Download Doctrine
i download it version 2.0 and 1.2
but
i cant find lab folder
where version i can find this folder ?
#171 by mo2men on October 30th, 2010
| Quote
sorry i mean lib not lab
#172 by Mattia on November 14th, 2010
| Quote
Hey mo2men,
If you’re not able to find it, just create the lib folder yourself: that works for me.
#173 by Willem on November 15th, 2010
| Quote
Type your comment here
Hi
I’ve the same problem, does anyone know a fix?
#174 by Ahmad on November 27th, 2010
| Quote
Hello mate It is grate job, but the website is not usable if you just change the text color because it is unreadable it should be lighter, because using a dark text color with dark background makes it difficult to read.
Thanks
#175 by Ahmad on November 27th, 2010
| Quote
sorry now the background has been downloaded
#176 by mikkelz on December 5th, 2010
| Quote
Thanks for the tutorials Burak. Found your website after listening to one of your CI tuts from Nettuts. Looking forward to the rest of this series on CI + Doctrine.
#177 by Chris Cooke on December 14th, 2010
| Quote
Thank you, this is a very stimulating tutorial. But as a beginner to some of this stuff I was thinking I had bitten off one too many framework – maybe I could cope with CI but throw in Doctrine as well! I got the same problems as Daryl #102 above with the same results after turning on “extension=php_pdo_mysql.dll” and restarting the web server. But studying your response #103, I noticed “extension=php_pdo.dll” in the ini file, so I turned that on as well. And would you believe it – it worked!!
Pingback: Day 21 – It Begins | FourLightLabs
#178 by rob on January 1st, 2011
| Quote
Are you using a different version of Doctrine? As I’ve just downloaded version 2 and there is a totally different folder structure, with no lib.
#179 by rob on January 1st, 2011
| Quote
Got it working by using version 1.2.3 from the doctrine site, but we definately need some clearer explanation on how to get doctrine version 2 setup.
#180 by Junaid Rehman on January 9th, 2011
| Quote
Sir, can you please make screencasts so it will be more easy to get practical knowledge and easy to follow… i am feeling difficulty in reading all this article…. as you are inspire of nettuts codeigniter from scratch so please make your screencast so that dummies like me can follow you easily… thanks in advance….
#181 by smd on January 13th, 2011
| Quote
An Error Was Encountered
Unable to load the requested class: doctrine
I’m getting such type of error what does it mean…i follwed same step as above provided .. first few steps working properly like hell codeiginter is working properly rest not please send me the reason to my mail id.
#182 by Schop on January 13th, 2011
| Quote
I definitely wan tto leanr this, but when I try to create the user table, the following error message shows up in my logs:
PHP Fatal error: Uncaught exception ‘Doctrine_Connection_Exception’ with message ‘PDO Connection Error: SQLSTATE[HY000] [2013] Lost connection to MySQL server at ‘reading initial communication packet’, system error: 111′ in /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Connection.php:480\nStack trace:\n#0 /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect()\n#1 /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Transaction.php(186): Doctrine_Connection_Mysql->connect()\n#2 /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Connection.php(1384): Doctrine_Transaction->beginTransaction(NULL)\n#3 /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Export.php(1201): Doctrine_Connection->beginTransaction()\n#4 /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Export.php(1099): Doctrine_Export->exportClasses(Array)\n#5 /var/www/ci_doctrine/system/application/plugins/d in /var/www/ci_doctrine/system/application/plugins/doctrine/lib/Doctrine/Connection.php on line 480, referer: http://ubuntu-server/ci_doctrine/index.php/doctrine_tools/create_tables
#183 by Schop on January 13th, 2011
| Quote
Never mind…stupid error on my part!
Thanks for the great tutorial!
#184 by Marcos Filho on January 20th, 2011
| Quote
Very good post! Keep going bro
#185 by Friend on January 23rd, 2011
| Quote
I’ve downloaded CodeIgniter_1.7.3 and i can’t found folder plugins >> system/application/plugins/
i’m newbie on CI, and plan to use it with doctrine. but now latest CI and doctrine is different. someone can help me ?
#186 by Chris Dart on January 28th, 2011
| Quote
I am having the same problem as Friend. I have Code Igniter 2.0 and Doctrine 2.0 and it seems that everything is different. I am getting an error that Doctrine_Manager does not exist. When I search for it or the getInstance method I don’t find anything.
#187 by Dusty on January 29th, 2011
| Quote
Plugins aren’t used in CodeIgniter 2.0, so the tutorial is broken.
Trackback: Quora
#188 by adam on February 1st, 2011
| Quote
replace plugins with helpers and with the latest doctrine 2.0 you’ll need to follow the instructions for class loading:
http://www.doctrine-project.org/docs/orm/2.0/en/reference/configuration.html#class-loading
#189 by adam on February 1st, 2011
| Quote
Also youll need to setup doctrine as a library with the following
http://www.doctrine-project.org/docs/orm/2.0/en/cookbook/integrating-with-codeigniter.html?highlight=connection%20manager
#190 by CUrious Onlooker on February 7th, 2011
| Quote
Please, no more webcasts – plain text is much better.
By the time they load etc., it’s a pain when everything is assumed to be ok to do it this way.
If you plan to webcast, make it option, as a link.
#191 by Siegfried on February 12th, 2011
| Quote
Veru good article – I am new to doctrine and codeigniter and found it very, very helpful
regards!
#192 by daniel on March 2nd, 2011
| Quote
hi,burak.I really appreciate what you do ,thanks for your sharing!
Pingback: Codeigniter – Frameworks de desenvolvimento « Coisas do Marcelo
#193 by Miami Web Designer on March 7th, 2011
| Quote
Great tutorials you got here. By any chance will you be updating this or creating a new series for Doctrine 2. Doctrine 2 is totally different from Doctrine 1.xx.
Anyway, thanks for the series, it really has helped me a lot.
Rey
#194 by Sujoy on March 11th, 2011
| Quote
superb! very good and simple start up example. thanks a lot dude.
#195 by Edwin Orellana on March 28th, 2011
| Quote
Hey mr, now that codeigniter reactor is up, there are no plugins for CI Reactor, where do we put the doctrine files?
#196 by bla on April 1st, 2011
| Quote
unfort. this isn’t working any more…
#197 by Rafael Monroy on April 6th, 2011
| Quote
Hi, now that codeigniter is version 2.0 no working with plugins folder, where do we put the doctrine files?
#198 by Siyavash Ghasseminia on April 11th, 2011
| Quote
hi
I tried to use you code. but i faced a fatal error :
Fatal error: Uncaught exception ‘Doctrine_Transaction_Exception’ with message ‘Rollback failed. There is no active transaction.’ in C:\Program Files\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Transaction.php:319
Stack trace:
#0 C:\Program Files\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1426): Doctrine_Transaction->rollback(NULL)
#1 C:\Program Files\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.php(136): Doctrine_Connection->rollback()
#2 C:\Program Files\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Record.php(1599): Doctrine_Connection_UnitOfWork->saveGraph(Object(User))
#3 C:\Program Files\wamp\www\ci_doctrine_day1\system\application\controllers\hello.php(17): Doctrine_Record->save()
#4 [internal function]: Hello->user_test()
#5 C:\Program Files\wamp\www\ci_doctrine_day1\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array)
#6 C:\Program Fil in C:\Program Files\wamp\www\ci_doctrine_day1\system\application\plugins\doctrine\lib\Doctrine\Transaction.php on line 319
what should I do ?
ps : I loved your work .
really waiting for your reply .
thanks man!
Pingback: Quick start with Codeigniter using some build-in Libraries | Web Application Solutions
Pingback: CodeIgniter and Doctrine | Me and My Self
#199 by Khairul on May 10th, 2011
| Quote
You can use this the follwing link to use doctrine in CI version 2
[http://www.tlswebsolutions.com/codeigniter-2-and-doctrine-2-integration-a-working-setup-doctrineignited/]
#200 by M. Ali on May 20th, 2011
| Quote
Hi all,
I’m two days into CI and just wanted to make one correction,
“class Hello extends Controller {”
Should be:
class Hello extends CI_Controller {
Took me a while to figure that out but if you actually read the user manual, it helps tons.
glhf
#201 by Raphael on June 2nd, 2011
| Quote
Great tutorial but which version of CI and Doctrine did u use?
thx..
Pingback: CodeIgniter tutorials | Jellydn's Blog
#202 by Thomas on July 14th, 2011
| Quote
Very nice tutorial – but it is a bit outdated. But it is good to read because gives you a nice intro to ORM. However If you want to integrate doctrine2 and CI 2.0.2 you should read this tutorial:
http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/
I have just created my first CI application with database integration very nice and easy ; )
Good luck
Pingback: Top 20+ MySQL Best Practices « Wesley’s Blog
#203 by anyulled on July 27th, 2011
| Quote
great Tutorial!! does this works with the latest version of Doctrine?
I have a Project with a database of about 18 tables and don’t want to create each of them manually. Is it there a way to have doctrine generate them in the correct folder?
Cheers
#204 by owais on August 4th, 2011
| Quote
i hav problem that when i execute my web browser for runing the script which code on dremwevewer fatl error message shown——what can i do plese solve my problem
#205 by owais on August 4th, 2011
| Quote
when we code ( ! ) Parse error: syntax error, unexpected ‘<' in C:\wamp\www\ci_doctrine_day1\system\application\controllers\hello.php on line 17
Call Stack
# Time Memory Function Location
1 0.0006 384304 {main}( ) ..\index.php:0
2 0.0021 453000 require_once( 'C:\wamp\www\ci_doctrine_day1\system\core\CodeIgniter.php' ) ..\index.php:201
this error shown what can i do????
#206 by wes on August 21st, 2011
| Quote
thomas ,#202 nice suggestion,.
thats the thing i was looking for ^^
#207 by Mindi Ehly on August 25th, 2011
| Quote
I will immediately grab your rss as I can’t find your email subscription link or e-newsletter service.Do you’ve any? Please let me know so that I could subscribe.Thanks
#208 by Amer on September 4th, 2011
| Quote
I downloaded Doctrine but there is no lib folder !
http://www.doctrine-project.org/projects/orm/download
#209 by kate moss on September 28th, 2011
| Quote
Being a newbie to PHP and of course doctrine and code ignitor, I was able to follow the tutorial intitutively, except for one instance, configuring Doctrine to connect to the actual mysql db. Using the steps defined above I couldnt connect to the DB and kept getting exception – Message: PDO::__construct() [pdo.--construct]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock). http://www.hermeshandbagoutlet.com
#210 by Ariel on October 29th, 2011
| Quote
Is Doctrine better than DataMapper?
Is Doctrine compatible with CI 2.0?
#211 by mb3l1nk on November 2nd, 2011
| Quote
just want to say thank’s for the tut….
excuse me, but i stil have a problem with this..
http://localhost/ci_doctrine/index.php/hello/user_test
… index.php is not found..what would i do, that i must make the index.php my own.??? thank’s..:)
Pingback: Prova articolo
Pingback: [转]Top 20+ MySQL Best Practices | My ideal.
Pingback: [转]Top 20+ MySQL Best Practices « 最醉红楼–成江东@sina weibo
#212 by Phaed on December 10th, 2011
| Quote
Great tutorial
best i’ve found on the subject, thank you so much!
p.s.
May want to take a look at your site’s background color. Nothing is readable for the first few seconds before your images load because of the brown background. Pretty annoying for those with a sluggish connection.
#213 by Amed on December 13th, 2011
| Quote
Hi, thank you for taking the time to write about CI and Doctrine. I have a big problem with my own configuration and integration of those things, I’m particularly working with Codeigniter 2.1 and Doctrine 1.2.4. So far, I could create from schema.yml the User.php class (considering a User entity for the example) and its generated/BaseUser.php parent, the problem is when I try to load-data or build-all-reload It always says that cannot find BaseUser in my User.php class, any idea why this is happening or anyone got the same problem?? let me know if you need more details….
Thanks…
Trackback: Website traffic is important for your online success, register with us on Autosurftraffic.info this month FREE
Trackback: paintball guns for sale
Trackback: agence de communication paris
Pingback: CodeIgniter and Doctrine from Scratch » CodeIgniter Resources
Trackback: Adikit.eu - The place where all scripts are nice and cheap!
Trackback: actualités web
Pingback: CodeIgniter and Doctrine from scratch. | 世界是平的
Pingback: CodeIgniter and Doctrine from scratch. | 世界是平的
Pingback: CodeIgniter and Doctrine from scratch. | 世界是平的
#214 by Sanny on January 31st, 2012
| Quote
Very Very Thanks. it is definately helpful when i’ve got trouble.Thanks
#215 by Mikhaelis on February 3rd, 2012
| Quote
Hi guys,
For those using the new version of CodeIgniter (2.1.0), you can get away with adding this line of code in the application/config/autoload.php : require APPPATH.’/plugins/doctrine_pi.php’. Then, line 28 in file application/plugins/doctrine_pi.php (require_once BASEPATH.’/libraries/Model.php’;) should be commented out. This is not an elegant solution nor definitive, but it avoids the problem in order to follow the rest of the tutorial.