EllisLab text mark
Advanced Search
1 of 2
1
   
CodeIgniter - Doctrine ORM Tutorial : A way of enhancing CI
Posted: 01 November 2009 01:31 PM
Avatar
Joined: 2007-05-08
21 posts

A brand new tutorial about how to use Doctrine as a CI’s plugin :

http://www.phpandstuff.com/articles/codeigniter-doctrine-from-scratch-day-1-install-and-setup

It can give ideas ? Nope ?

 Signature 

Technology Changes, Human Nature Doesn’t

Bleekom | PHPTechnoFrame

 
Posted: 01 November 2009 04:10 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts

Thanks for linking to my article smile

Writing the 3rd episode right now.

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 06 November 2009 03:27 AM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-08-05
58 posts

Hmm.. seems interesting grin

 Signature 

Personal Website:
http://www.ifadey.com

Photography on Flickr:
http://www.flickr.com/fadey86

 
Posted: 06 November 2009 08:29 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-05
176 posts

Good. Thanks.

 Signature 

cool smile Saidai Jagan

 
Posted: 06 November 2009 03:04 PM   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts

For those interested, 3 more articles have been posted:

Day 2 - The Basics
http://www.phpandstuff.com/articles/codeigniter-and-doctrine-from-scratch-day-2-the-basics

Day 3 - Signup Form
http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-3-user-signup-form

Day 4 - User Login
http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-4-user-login

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 16 November 2009 07:50 AM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2008-03-13
515 posts

a good series, thanks lane4.

 Signature 

:wq

 
Posted: 16 November 2009 08:14 AM   [ # 6 ]   [ Rating: 0 ]
Joined: 2009-04-21
395 posts

@lane - I like the clean code you get in the controller by putting the form_validation in a function(_submit_validate()). I’m going to nick that idea. Great stuff!

 Signature 

I love the smell of code in the morning.

 
Posted: 16 November 2009 08:30 AM   [ # 7 ]   [ Rating: 0 ]
Joined: 2008-01-15
5 posts

Great! Thanks!! smile

 
Posted: 16 November 2009 03:15 PM   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts

Thanks everyone.

Day 5 and Day 6 have been posted, and more of them are coming very soon.

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 16 November 2009 08:37 PM   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2939 posts

You’ve done a huge amount of work here and I’m sure it’s greatly appreciated by the community.

From my experience using MVC I’ve concluded that it’s not such a good idea to use any data objects in the controller directly.

Doing this then requires all of your application business logic to be in the controller also when it should really be in your models.

The model should encapsulate the Doctrine objects rather than being replaced by them. Even your diagram (in Part 1) shows business logic being in models but your code examples don’t.

Maybe at some point you could give examples of how a model might encapsulate the Doctrine data objects. Thanks.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
Posted: 16 November 2009 08:52 PM   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts
wiredesignz - 17 November 2009 01:37 AM

You’ve done a huge amount of work here and I’m sure it’s greatly appreciated by the community.

I’m beginning to believe that it’s not such a good idea to use any data objects in the controller directly.

Doing this then requires all of your application business logic to be in the controller also when it should really be in your models.

The model should encapsulate the Doctrine objects rather than being replaced by them. Even your diagram (in Part 1) shows business logic being in models but your code examples don’t.

Can you be more specific? I am open to suggestions.

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 16 November 2009 09:05 PM   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2939 posts

I thought that was specific.

Business logic is that logic that makes your application function and is not related to the request, input validation or the response.

The business logic is that which might ensure a user does not register with a username of `Administrator` or that some monetary value when multiplied by some other value does not end up being a negative number etc.

Your models in an MVC context, are supposed to provide this logic. Your data objects should be encapsulated by the model and used in context of the application business logic.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
Posted: 16 November 2009 09:18 PM   [ # 12 ]   [ Rating: 0 ]
Joined: 2009-10-18
102 posts

hi there,

just want to ask if ORM support xampp? haven’t tried yet ORM. :D

thanks

 
Posted: 16 November 2009 09:27 PM   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts
wiredesignz - 17 November 2009 02:05 AM

I thought that was specific.

Business logic is that logic that makes your application function and is not related to the request, input validation or the response.

The business logic is that which might ensure a user does not register with a username of `Administrator` or that some monetary value when multiplied by some other value does not end up being a negative number etc.

Your models in an MVC context, are supposed to provide this logic.

Doctrine does have support for Data Validation, and it’s actually more extensive than the CI form_validation class. And it also supports custom validators, where you could for example check for special usernames like (‘Administrator’) as you just mentioned.

I am already planning on making that part of an upcoming episode.

The thing is, I just can’t present all the concepts at once in the very first Model I create in the tutorials. I need to go at a certain pace, as these are meant to be readable by beginners in CI and Doctrine.

Thanks for bringing it up though. If you have any other specific suggestions let me know.

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 16 November 2009 09:28 PM   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
53 posts
kikz4life - 17 November 2009 02:18 AM

hi there,

just want to ask if ORM support xampp? haven’t tried yet ORM. :D

thanks

It should work, as long as PDO is enabled with MySQL support (unless you want to use a different db driver).

 Signature 

CodeIgniter tutorials and more:

http://www.phpandstuff.com

CodeIgniter and Doctrine from scratch:

Day 1 - Day 2 - Day 3 - Day 4

 
Posted: 16 November 2009 09:37 PM   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-10
2939 posts

Just to be clear, form (input) validation in the controller is not the same thing as data validation in your model.

The controller checks and cleans the incoming data and ensures that each field meets a minimum requirement. It should not try to check if the data values are suitable for use by the application.

ie: A login form with username and password should be form validated only to ensure the fields exist and are minimum length etc. Your business logic in the model should then make the comparisons and verify the actual values submitted and give a result back the controller so it knows how to respond to the user input.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

 
1 of 2
1