Jonah Bron wrote:Technical wrote:MVC structure is starting to disappoint me. Hell, I need to create 3 classes for just to display a single article. Is it really worth it? Before I just had Display() method in each class.
If your application is too simple, MVC may not be the right pattern in this case.
I wouldn't call it so simple, but MVC makes it more complex.
So what I have, for example content module:
1) ContentItem class - used to create and edit articles. Has __construct method which queries database by id and fills object properties; Display() method for obvious needs; Save() method for saving into database.
2) ContentCollection - used to display a group of items with certain criteria like search. Has __construct method which queries database and fills the array and Display method.[/list]
What I plan to do:
1) Create universal model Collection for uses like
Code: Select all
$Collection = new Collection('ContentItem');
2)Controller will be represented not by class[/list]
So ContentItem and Collection are models, module file is a controller and Content class is a view.
Code: Select all
$Item = new ContentItem(1); // For single item
Content::Item($Item);
$Collection = new Collection('ContentItem', 0, 10);
Content::Items($Collection);
I think that will be fine.