Welcome Guest, Not a member yet? Register   Sign In
MVC vs OOP in general?
#11

[eluser]Phil Sturgeon[/eluser]
Wired: I'm not going to bother trying to find a reference link just to defend a point that most people will agree on. Models can extend ORM to implement it, therefore than model becomes an ORM model. This principle is used in Rails, Kohana and most major frameworks that use ORM.

[quote author="Joey Dendron" date="1291306127"]

Another related question I came up with last night was: I'm guessing that there are instances where code in a model will instantiate an object from a class, but not using CI's $this->load functionality? EG if you're building an extended model that's an object composed of other objects? Is that valid?

Thanks again for your help, it's pretty inspiring to see new vistas on the horizon.

Dave[/quote]

You're missing my suggestion of using autoload, but you can use $this->load in order to make Models extend each other. The autoload solution is far easier, as you can do things like this:

Code:
// models/a.php
class A extends Model {}

// models/b.php
class B extends A {}

If you use autoload and $this->load->model('b'); then it will automatically call class A for that instance.
#12

[eluser]wiredesignz[/eluser]
@Sturgeon, The fact is you cannot find any real literature that identifies ORM and it's DAO's as models. But still insist that they are because everyone else says so. Excellent free thinking and logic buddy.

http://en.wikipedia.org/wiki/Object-relational_mapping

Nope don't see it there either.
#13

[eluser]WanWizard[/eluser]
This is all a matter of semantics, in the end they're all PHP classes, and you use them the way it suits you best.
#14

[eluser]Phil Sturgeon[/eluser]
Right Wan.

Wired, I said Models can implement ORM, not ORM === MODELS.

Give it a rest, I'm at work and unlike you I don't spend the day arguing on IRC and trolling people on forums. When I have the time I'll post back.
#15

[eluser]wiredesignz[/eluser]
Discussions are the foundation of forums Philip, not everyone is required to believe everything you say. I have asked you to back up your comments.

IRC is also a medium for discussion (heated or not), it's just that some people like you do not like to be challenged.

And if you are at work I suggest you get on with it.

@WanWizard. Yes semantics indeed, so if they are just data objects then stop calling them models.
#16

[eluser]Phil Sturgeon[/eluser]
Why do I need to back up the fact that Models can extend ORM?

Rails

Code:
class Book < ActiveRecord::Base

Kohana

Code:
class Model_User extends ORM

Doctrine

Code:
class User extends Doctrine_Record


I have no issues whatsoever with people disagreeing with me, what gets me is your constant "Sturgeon you are clueless man". You keep that opinion as much as you like, but don't use it as the basis of your conversation when everybody else is trying to be constructive or discuss a valid point.
#17

[eluser]wiredesignz[/eluser]
You are still doing it Phil, I don't see anything more than a few lines of code. Any fool can write that.

Give me something in terms of conceptual literature or a design pattern.

You need to stop preaching to people until you know what you are talking about Phil. Then I might offer you some respect.
#18

[eluser]Phil Sturgeon[/eluser]
Doctrine - Introduction to Models

Rails - Models

Kohana ORM

You are arguing a non-point here. Models can extend ORM to become ORM Models. End of.
#19

[eluser]wiredesignz[/eluser]
You still don't get it.

A group of developers have decided to use the word "model". This does not make it correct.

Here is a technical discussion about Models and what they represent in the MVC triad:

http://www.phpwact.org/pattern/model_view_controller

Quote:The model encapsulates the functional core of an application, its Domain (Business) Logic. The goal of MVC is to make the model independent of the view and controller which together form the user interface of the application. An object may act as the model for more than one MVC triad at a time.

Therefore a model may encapsulate ORM data objects to provide your business logic. It is not part of ORM itself nor does it extend ORM in any way.
#20

[eluser]WanWizard[/eluser]
You still don't get it.

Everyone here knows what is meant if one uses the word "model", which is a class that provides an abstraction layer between the controller and the data store.

Nobody cares (but you?) what the "official" meaning of the word is. Most people use codeigniter because it doesn't force you into the straitjacket of a formal specification.




Theme © iAndrew 2016 - Forum software by © MyBB