Today we will continue building our Message Board project. First we will start building the Home Page, which will be a Forum List. Then we will learn about Doctrine Data Fixtures. This will help us create some test data to play with.
"CodeIgniter and Doctrine from Scratch" Series:
First, Some Styling
Before we get started, let’s add some style so that pages look somewhat decent. Just copy-paste, and don’t read it. CSS is not our focus today.
- Edit: css/style.css
body {
font-family: "Trebuchet MS",Arial;
font-size: 14px;
background-color: #212426;
color: #B9AA81;
}
a {
color: #FFF;
}
a:hover {
color: #B9AA81;
}
input, textarea, select {
font-family:inherit;
font-size:inherit;
font-weight:inherit;
}
/* FORUMS -----------------------------------------*/
div.forums {
width: 720px;
margin: auto;
}
.forums h2 {
font-size: 16px;
color: #000;
padding: 5px 10px 5px 10px;
margin: 0px;
background-color: #BBB;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
}
.forums h3 {
font-size: 15px;
margin: 0px;
}
.category {
margin-bottom: 40px;
}
.forum {
border-bottom: 1px solid #666;
padding: 10px;
}
.forum .description {
font-size: 14px;
}
/* SIGNUP FORM ------------------------------------*/
#signup_form {
margin-left: auto;
margin-right: auto;
width: 360px;
font-size: 16px;
}
#signup_form .heading {
text-align: center;
font-size: 22px;
font-weight: bold;
color: #B9AA81;
}
#signup_form form {
background-color: #B9AA81;
padding: 10px;
border-radius: 8px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
}
#signup_form form label {
font-weight: bold;
color: #11151E;
}
#signup_form form input[type=text],input[type=password] {
width: 316px;
font-weight: bold;
padding: 8px;
border: 1px solid #FFF;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
#signup_form form input[type=submit] {
display: block;
margin: auto;
width: 200px;
font-size: 18px;
background-color: #FFF;
border: 1px solid #BBB;
}
#signup_form form input[type=submit]:hover {
border-color: #000;
}
#signup_form .error {
font-size: 13px;
color: #690C07;
font-style: italic;
}
Ok, now we’re ready to get more coding done!
The Home Page
We are about to work on the Controller and the View for our Home Page (i.e. Forum List). We want this page to show all of the Forums broken down by Categories.
Home Controller
- Edit: system/application/controllers/home.php
<?php
class Home extends Controller {
public function index() {
$vars['categories'] = Doctrine::getTable('Category')->findAll();
$this->load->view('home', $vars);
}
}
As mentioned before, variables are passed to a View in an array, and the array indexes become variable names. In other words, $vars['categories'] becomes $categories inside the View.
Doctrine::getTable(’Category’)->findAll(); gives us all of the Category records, in the form of a Doctrine_Collection object.
Home View
(I’m going build this page in a few steps)
- Edit: system/application/views/home.php
First we make a blank page, with a container div and a heading:
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home</title> <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all"> </head> <body> <div class="forums"> <h1>CI+Doctrine Message Board</h1> </div> </body> </html>
Next, we loop thru the $categories object, and display titles for each Category:
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home</title> <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all"> </head> <body> <div class="forums"> <h1>CI+Doctrine Message Board</h1> <?php foreach($categories as $category): ?> <div class="category"> <h2><?php echo $category->title; ?></h2> </div> <?php endforeach; ?> </div> </body> </html>
Note: $categories is a Doctrine_Collection object here, but it can be treated like an array. So we can use foreach on it.
Now we are going to show each Forum, their descriptions, and number of Threads.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Home</title>
<link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css"
type="text/css" media="all">
</head>
<body>
<div class="forums">
<h1>CI+Doctrine Message Board</h1>
<?php foreach($categories as $category): ?>
<div class="category">
<h2><?php echo $category->title; ?></h2>
<?php foreach($category->Forums as $forum): ?>
<div class="forum">
<h3>
<?php echo anchor('forums/'.$forum->id, $forum->title) ?>
(<?php echo $forum->Threads->count(); ?> threads)
</h3>
<div class="description">
<?php echo $forum->description; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
</body>
</html>
As you can see, getting all Forums under a Category is as easy as calling $category->Forums. And again, we can treat it as an array and loop thru it.
Line 26: We are creating a link to the Forum. It will link to a Controller named Forums and pass the id in the url. And the link text is the Forum title.
Note: In CodeIgniter, Controllers and Models cannot have the same name. That’s why I linked to ‘forums’ instead of ‘forum’. Some people might prefer ‘view_forum’ or ’show_forum’ etc…
Line 27: This is the first time we are using count(). That’s how we get the number of Threads that belong to that Forum object.
The Result
You will see this:

Looks nice. But the links are broken since we haven’t created the Forums Controller (i.e. Forum Page) yet.
Now, we could go ahead and build the Forum Page, but it’s just not going to look very good since we have no Threads or Posts whatsoever. This is a great time to start talking about Data Fixtures.
Doctrine Data Fixtures
What are Data Fixtures?
“Data fixtures are meant for loading small sets of test data through your models to populate your database with data to test against.” (from here).
This will do the job for filling the database with some data, so we can do proper testing as we develop our project.
In the last article, we created a Test Controller for inserting some data. That worked well for this tutorial, and we saw some code examples along the way. But on a real development environment, it’s better to just use Data Fixtures.
Creating Fixtures
First, we need to have a place to put our Fixtures. You can put this folder anywhere, but I would like to create it directly under the applications folder.
- Create Folder: system/application/fixtures
- Create: system/application/fixtures/data.yml
That’s right, we are creating a YAML file. Don’t worry if you are not familiar with this file format.
We are going to start small with an example:
User:
Admin:
username: Administrator
password: testing
email: programming@gmail.com
Test:
username: TestUser
password: mypass
email: test@test.com
Even if you are not familiar with YAML, the structure is easy to understand.
This code just creates 2 User records.
Note: I used 2 spaces for indentation, but it can be any number of spaces. And Tabs do NOT work.
- First line is the name of the Model we are loading data for.
- Line 2 and 6: These are just names for these records. They can be anything. We can use them later in the fixture to reference these records.
- The rest should be obvious. We are assigning data to each field for these records.
Now, we need to load this fixture into the database.
- Edit: system/application/controllers/doctrine_tools.php
<?php
class Doctrine_Tools extends Controller {
// ....
function load_fixtures() {
echo 'This will delete all existing data!<br />
<form action="" method="POST">
<input type="submit" name="action" value="Load Fixtures"><br /><br />';
if ($this->input->post('action')) {
Doctrine_Manager::connection()->execute(
'SET FOREIGN_KEY_CHECKS = 0');
Doctrine::loadData(APPPATH.'/fixtures');
echo "Done!";
}
}
}
We added a function named load_fixtures() to this Controller.
Doctrine:loadData() does the work. Every time it is called, it will purge existing data from the tables, and load the Data Fixtures from the given path. If you don’t want the table purge to happen, you need to pass a second argument as true.
(I also had to disable FOREIGN_KEY_CHECKS to avoid some foreign key related errors during the purge.)
- Go to: http://localhost/ci_doctrine/doctrine_tools/load_fixtures and click the button.
- Now check the user table in phpmyadmin.

Now that everything seems to be working, let’s expand our fixture so we have more data to work with.
- Edit: system/application/fixtures/data.yml
User:
Admin:
username: Administrator
password: testing
email: programming@gmail.com
Test:
username: TestUser
password: mypass
email: test@test.com
Foo:
username: Foobar
password: mypass
email: test2@test2.com
Forum:
Forum_1:
title: Introduce Yourself!
description: >
Use this forum to introduce yourself to the CodeIgniter community,
or to announce your new CI powered site.
Forum_2:
title: The Lounge
description: >
CodeIgniter's social forum where you can discuss anything not related
to development. No topics off limits... but be civil.
Forum_3:
title: CodeIgniter Discussion
description: This forum is for general topics related to CodeIgniter.
Forum_4:
title: Code and Application Development
description: >
Use the forum to discuss anything related to
programming and code development.
Forum_5:
title: Ignited Code
description: >
Use this forum to post plugins, libraries, or other code contributions,
or to ask questions about any of them.
Category:
Lounge:
title: The CodeIgniter Lounge
Forums: [Forum_1, Forum_2]
Dev:
title: CodeIgniter Development Forums
Forums: [Forum_3, Forum_4, Forum_5]
Thread:
Thread_1:
title: Hi there!
Forum: Forum_1
Thread_2:
title: Greetings to all
Forum: Forum_1
Post:
Post_1:
Thread: Thread_1
User: Test
created_at: 2009-11-20 01:20:30
content: >
Hello everyone! My name is Test, and I go to school at
Test Institute of Technology in the US.
I just found CodeIgniter some time last week and have been
reading through the documentation trying to get myself acquainted.
Hopefully the forums will be a great help! I already have some questions.
Thanks!
Post_2:
Thread: Thread_1
User: Admin
created_at: 2009-11-20 02:15:33
content: Welcome Test! Nice to meet you.
Post_3:
Thread: Thread_2
User: Foo
created_at: 2009-11-19 12:14:50
content: I am new here. Just wanted to say hi.
This is just a bunch of structured data, nothing complicated. For each Model, we create a few records. And we have a few new things to mention:
Line 18: Here you can see the syntax for adding a long string value in multiple lines.
Line 51: We are setting up the relationships between records. This line says Thread_1 belongs to Forum_1.
Line 43: Again, we are setting up relationships, but this time we are assigning multiple records, and you see the syntax for that.
- Go to: http://localhost/ci_doctrine/doctrine_tools/load_fixtures and click the button.
- And, go to phpmyadmin and look at all the tables.

We just created 15 records!
See the Results

We can see all the Categories and Forums we just created. Also there are 2 Threads now, as we can see from the count.
Stay Tuned
Our Message Board is starting to take shape. Meanwhile we learned about a new concept called Data Fixtures, which is very helpful during the development process.
In the next tutorials we will go deeper into the project and keep building more functional pages.
See you next time!

#1 by Carlos on November 20th, 2009
| Quote
Dude! seriously you have a gift for teaching.
I was wating all week for the part 7
Thankyou
#2 by Zack on November 20th, 2009
| Quote
This is the best series on the internet. I’m not even kidding.
#3 by shinokada on November 20th, 2009
| Quote
Question about line
$category->Forums as $forum
and
$forum->Threads->count();
I am wondering what would it be without doctrine.
Could you explain it so that it will tell us how useful to use doctrine?
#4 by Burak on November 20th, 2009
| Quote
Well, those were made possible because of the model relationships we setup in Day 6 article.
Without Doctrine, it would be a lot more work I think. You would have to write a method in the Category Model called “Forums()” that would return an array of Forum objects. It would have to run some join queries in the database to get you the results.
You would then have to do the same in the Forum Model and create a method named Threads(). Actually, you would pretty much have to do this for every single relationship between all your Models.
Or if you wanna be lazy, you could write just one function, that returns all Categories and all Forums in a 2 dimensional array or something. Or you could write functions like these: get_forums_by_category_id(), get_threads_by_forum_id(), get_posts_by_thread_id() etc… It will just keep growing as you add more Models.
Or you can even put your queries directly into your Controllers (as some people completely avoid using Models in the first place). But doing stuff like that can lead to unmaintainable code.
#5 by Jure on November 22nd, 2009
| Quote
Thank you Burak, these tutorials are fantastic.
I have a workflow question: I need to run a prepare_page function, that would get all the data from a table in DB ($p = Doctrine::getTable(’E_page’)->findOneBytitle_url) but I need the results to be adjusted before returned as an array – or even better, a doctrine object.
What I mean – some fields stay the same ($p->title) but some need tweaking (add “” as prefix to $p->content for instance).
Before Doctrine, I did all this in a CI model, query the DB and fill an array. What should I do now – create a class like you did for Login or just use a helper? Maybe add a function to the Doctrine_Record like you did for password hashing? Can I add things to the doctrine object (or overwrite some existing ones like $p->title) or do I need to create a new array and then return it?
Thanks again!
#6 by Burak on November 22nd, 2009
| Quote
findOneBytitle_url will return a Doctrine object, not an array. You only get an array if you use to_array() or HYDRATE_ARRAY.
To modify the returned values, without actually modifying the saved data, you can use Custom Accessors. What I used for the password field was a Custom Mutator, which actually alters the saved data.
The documentation is a bit lacking on this, but I think it works like this:
put this in setUp():
$this->hasAccessor(’content’, ‘customContentAccessor’);
create the accessor method:
public function customContentAccessor() {
return ‘“”’ . $this->_get(’content’);
}
I haven’t tested this, you’re gonna need to give it a try.
Also, there is a warning in the docs about this:
“Custom accessors and mutators will not work when hydrating data as anything except
records. When you hydrate as an array it is only a static array of data and is not object
oriented. If you need to add custom values to your hydrated arrays you can use the some of
the events such as preHydrate and postHydrate”
I hope this helps.
#7 by Jure on November 22nd, 2009
| Quote
Thank you, this would work yes, but I see it’s actually easier to just convert the Doctrine object to array and pick out what I need, filling my custom array and returning it.
Everything in yout tutorials has worked great so far, but I have one big issue – UTF-8 doesn’t work with doctrine. I have my DB & table set to utf8 / utf8_unicode_ci and it should work normally, but all the queries mess up the (correct) utf-8 characters in the table.
I tested the same query using CI Active Record and the foreign letters work OK.
Any ideas? Thank you!
#8 by Jure on November 22nd, 2009
| Quote
Huh, this was starting to really scare me, but I managed to solve the problem.
It requires a little change in your doctrine_pi.php (plugin file for codeigniter).
I changed this line:
Doctrine_Manager::connection($dsn,$connection_name);
To this:
$conn = Doctrine_Manager::connection($dsn,$connection_name);
$conn->setCollate(’utf8_unicode_ci’);
$conn->setCharset(’utf8′);
Hope this helps someone.
#9 by Burak on November 22nd, 2009
| Quote
Yeah, it doesn’t seem to default to utf8 unless you specify.
It can also be done at the table level if needed.
#10 by Scott M on November 22nd, 2009
| Quote
I assume you’re eventually going to change that Doctrine::getTable(’Category’)->findAll(); to DQL?
getTable is lazy loading, so in each loop of “foreach($category->Forums as $forum):” it’s going to fire off another query.
excuse me if I’m jumping the gun!
#11 by Burak on November 22nd, 2009
| Quote
Good point. I do plan on writing about Optimization. Maybe I can bring this up in that article.
#12 by adaxi on November 24th, 2009
| Quote
Hi ! This is really a great tutorial, its my first experience with PHP, Code Igniter and Doctrine. This tutorial is really great and easy to understant even to a PHP beginner, I have to say that I have some JSP, Struts and EJB experience, which make things easier.
As Carlos said “you have a gift for teaching.”
Could I ask you something, can you do a tutorial (or at least do a simple explanation) about languages ? I live in Belgium, and we have 3 official languages here … this feature might be really useful for me !
Well thanks anyway for this great tutorial.
#13 by Mustafa Kahraman on November 27th, 2009
| Quote
Hi, All
I can’t wait for the next tuts. I just sit and read all 8 tuts they are really easy to understand. You are amazing my friend…
Thanks for all,
#14 by Marcel Marnix on November 28th, 2009
| Quote
If you don’t want the table purge to happen, you need to pass a second argument as true.
Where do I pass this second argument?
I’ve tried:
Doctrine::loadData(APPPATH.’/fixtures’,true);
and
http://localhost/ci_doctrine/doctrine_tools/load_fixtures/true
But both delete my existing data.
BTW THANKS FOR THIS GREAT TUTORIAL,
I am still planning to create multiple applications with lot’s of relatonal tables, and doctrine sure got my attention now!
(Even if I am still looking for a generic program that reads the table and record properties and relations(innodb) out of the database.)
#15 by Burak on November 30th, 2009
| Quote
This is from the Doctrine docs:
If you want to append the imported data to the already existing data then you need to use the second argument of the loadData() function. If you don’t specify the second argument as true then the data will be purged before importing.
Here is how you can append instead of purging:
Doctrine::loadData(’/path/to/data.yml’, true);
I tried it and it seems to work, except that I got some duplicate entry errors because of unique fields.
Also, Doctrine does support creating Models directly from an existing database.
#16 by Emre on November 30th, 2009
| Quote
What to do to avoid duplicate entry errors?
I have no unique fields but trying to load categories which have self reference. A simple parent-child relationship..
My yaml is:
Kategori:
root:
ad: root
kat1:
ad: Kategori1
KategoriList: [kat2]
kat2:
ad: Kategori2
UstKategori: kat1
#17 by Emre on November 30th, 2009
| Quote
ok I solved by changing model. I have copied from Doctrine manual. Would you mind if you check this model class at this link : http://www.doctrine-project.org/documentation/manual/1_1/en/real-world-examples#forum-application
The Forum_Category has a one-to-many with itself.Is the mapping ok?
$this->hasMany(’Forum_Category as Subcategory’, array(
‘local’ => ‘parent_category_id’,
‘foreign’ => ‘id’
)
);
the local and foreign fields shouldn’t be inverse order? Sorry but I am really confused
#18 by Burak on November 30th, 2009
| Quote
Yea, I would think the foreign id would be parent_category_id.
Also, you can look into the NestedSet behavior if you want to accomplish that:
http://www.doctrine-project.org/documentation/manual/1_1/en/behaviors#core-behaviors:nestedset
#19 by Zack on November 28th, 2009
| Quote
Don’t forget about us!
#20 by Dimitar on December 1st, 2009
| Quote
How I can tell the table on witch connection belongs. I have 2 databases and Exampe:
– table users from database Admin
– table payments from database products
How I can map this using doctrin and ci?
Thanks in advance
#21 by Zack on December 1st, 2009
| Quote
I know you’re not asking me, but I think your best best is to get all that information into the same database, rather than keeping two database connections live.
You could always do that, but the overhead would be ugly.
#22 by Burak on December 1st, 2009
| Quote
Try this. Put this line right before the class definition, for example in users.php, as the first line in the file:
Doctrine_Manager::getInstance()->bindComponent(’Users’, ‘admin’);
‘admin’ being your connection name. If you used the plugin file from my tutorials, the connection names come from the array index of the $db array found in system/application/config/database.php
like this:
$db['admin']['hostname'] = “”;
$db['admin']['username'] = “”;
$db['admin']['password'] = “”;
$db['admin']['database'] = “”;
etc…
#23 by Marco on December 2nd, 2009
| Quote
Awesome articles, I’m learning MCV programming after being used to procedural coding. Not so simple step… with these tutorials is much interesting! I’m waiting for the next lesson…
#24 by Fatih on December 3rd, 2009
| Quote
Burak, gerçekten çok güzel bir seri.Devamını bekliyoruz
#25 by Iain Kay on December 13th, 2009
| Quote
First off I have to say that this series of tutorials has been one of the best I have read online in a long time. You explain things so well and basically just made Code Igniter a reality for me, rather than just something I may have played with for a while.
I’m having an issue with the fixtures and data.yaml file however. I have copied & pasted the load_fixtures() function in to doctrine_tools controller and have created the data.yaml file inside a folder called ‘fixtures’ directly under the application folder.
When I run /doctrine_tools/load_fixtures in my browser the form is shown correctly and I can click the submit button and have “Done!” printed on screen. Every time it runs it does manage to clear the database but it never inserts the Users from the first yaml file.
Any ideas where it could be going wrong? I had initially typed out the code but even after copying and pasting it in I’m still experiencing the same issue.
I haven’t changed any of the files from the versions in the tutorial. My development server is setup with CentOS 5.4, Apache 2.2.x, PHP 5.2.11, MySQL 5.0.x with suPHP and suhosin.
#26 by Burak on December 13th, 2009
| Quote
The file name should be data.yml instead of data.yaml
#27 by Iain Kay on December 14th, 2009
| Quote
D’oh! Don’t I feel stupid!
I really should have just gone and got some sleep rather than having more coffee and swearing to myself that everything was correct after skim reading the article about 20 times.
#28 by Ansh on December 22nd, 2009
| Quote
i m getting after submission of view i m loading same view so i can see data i just entered.
where i m wrong ???
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: mood
Filename: views/view_moods.php
Line Number: 316
this is wht i m doing in side view….
mood_name; ?>
#29 by Ansh on December 22nd, 2009
| Quote
but its working fine if i m loading tht page..and also its showing data. in same page but only when i add new records tht error come.
#30 by Ansh on December 22nd, 2009
| Quote
Solved I wasnt given variable name when i was loading View inside Submit Function.
#31 by MarcelMarnix on January 4th, 2010
| Quote
Hi Burak,
I’ve created a yaml schema:
appication/schema/db.yml with some tabels and detect_relations: true.
How can I generate the models from yaml using php?
(like you load your fixtures)
I can only find examples using the command line.
thanks in advance
#32 by MarcelMarnix on January 4th, 2010
| Quote
Found it.. after 4 hours fighting…
I altered doctrine_tools.php
Doctrine::generateModelsFromYaml( ‘C:\wamp\www\ci_doctrine\application\schema\db.yml’, ‘models’ );
Doctrine::createTablesFromModels();
First I used order for my orders table (mysql didn’t like it)
Then when creating an integer standard, biginteger is chosen, after altering doctrine_pi.php to:
// set the default primary key to be named ‘id’, biginteger, 5 bytes
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
array(’name’ => ‘id’, ‘type’ => ‘integer’, ‘length’ => 5));
Solved that problem as well…
#33 by Burak on January 9th, 2010
| Quote
If you want BIGINT, you need 8 bytes. I guess 5 worked for you if Doctrine is rounding it up to 8.
#34 by Marcello Romani on January 5th, 2010
| Quote
Thanks again for the tuts.
I am encountering an error while loading data.yml. Here is the first part of the text:
Fatal error: Uncaught exception ‘Doctrine_Connection_Mysql_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘title’ cannot be null’ [...]
Unfortunately, the long message doesn’t include the table name.
I’m going off to the Doctrine site to see how to enable more verbose debugging. Will post here later, hoping to help others (and me in a few weeks
#35 by Marcello Romani on January 5th, 2010
| Quote
Ok, I think I found the problem.
First, to make Doctrine’s exception messages a bit more readable, I enclosed them in regions. Instead of just calling Doctrine::loadData, I wrote:
try {
Doctrine_Manager::connection()->execute(’SET foreign_key_checks = 0′);
Doctrine::loadData(APPPATH . ‘/fixtures’);
}
catch (Doctrine_Exception $e) {
echo “An exception occurred:$e”;
}
By having the error message well-formatted, I spotted where the “table” information is:
Doctrine_Connection_UnitOfWork->saveGraph(Object(Forum))
which appears around step #6 on the stack trace.
I checked the “Forum” section in the yaml file, but couldn’t find anything wrong or missing. The problem stems from the fact that the Category section is specified _before_ the Forum section:
Category:
Lounge:
title: The CodeIgniter lounge
Forums: [Forum_1, Forum_2]
Dev:
title: CodeIgniter development forums
Forums: [Forum_3, Forum_4, Forum_5]
The data importer must create the empty Forum records to have values for the foreign key fields forum_id in the Category records, but the “NOT NULL” constraint on the Forum table for the ‘title’ field prevents this.
Solution: define the forums before referencing them in the Category section.
#36 by Marcello Romani on January 10th, 2010
| Quote
The error message should be enclosed in tags. Thus this piece of code
catch (Doctrine_Exception $e) {
echo “An exception occurred:$e”;
}
was meant to be instead:
catch (Doctrine_Exception $e) {
echo “An exception occurred:$e”;
}
#37 by Burak on January 10th, 2010
| Quote
Are there any problems with the fixture in this article? Forum section is indeed specified before the Category section. Did you have it different on your end?
Thanks for the exception handling tip, btw.
#38 by Marcello Romani on January 10th, 2010
| Quote
In the exception tip the essential bit is being taken away somewhere along the path… I wanted to write about PRE tags, but they’ve been eaten. I’ll try to repeat here (add ‘less than’ and ‘greater than’ signs as required):
The error message should be enclosed PRE in tags.
catch (Doctrine_Exception $e) {
echo “An exception occurred: PRE $e /PRE”;
}
Yes, you’re right. The fixtures in this article are correct.
I must have made a mistake while copying the code. I typed all of the tutorial by hand, with no cut’n'paste; it helps me learn, but can lead to mistakes…
#39 by Jon P on January 7th, 2010
| Quote
These tutorials are amazing!
I’m having an issue with the created_at field in the fixture. The database stores the datetime as the current datetime instead of what the fixture says. Do you have any idea as to why this is?
#40 by Burak on January 10th, 2010
| Quote
Oh, thanks for noticing this. Looks like the date values need to be enclosed in quotes.
#41 by ajit on January 28th, 2010
| Quote
special characters does not show in input box in codeigniter
but it’s work in simple html
pl’s give the answer today