I want to have my cakephp and eat it too.

Permalink
<rant>

I think C5 is awesome, it's my goto CMS for just about every site I make, but there are some things that just seem to big for it...Namely database applications. C5 has SOME MVC elements but is lacking the things that are really needed for a full MVC project.

But I'm usually torn, sometimes I need features from BOTH projects. So its usually a choice between giving the client an easy to use interface, and a set of reusable blocks -OR- getting to use a real Object Relational Mapper for doing database calls. I really really want both!

If someone was to combine C5 and cakePHP. We would finally have a framework that has everything needed to build anything!

</rant>

internalfx
View Replies:
Tony replied on at Permalink Reply
Tony
I'm also a big fan database mapped objects. I haven't dug into it too deeply within concrete5, but ADOdb Active Record, concrete's core database library, does have object relational mapping:

class person extends ADOdb_Active_Record{}

$person = new Person();
$person->nameFirst = 'Andi';
$person->nameLast = 'Gutmans';
$person->save();

http://phplens.com/lens/adodb/docs-active-record.htm...
RadiantWeb replied on at Permalink Reply
RadiantWeb
Tony...you're my C5 hero. just sayin'. :-)

C
jordanlev replied on at Permalink Reply
jordanlev
I was excited when I first realized that C5 includes an ActiveRecord implementation. But after using for a few projects, I've given up on it because it is not very feature-complete (for example, it doesn't handle many-to-many relationships), and it also is somewhat buggy (for example, if you create a new record, and the record's table has an auto id field, you need to explicitly set that id value to null in your code otherwise the record won't save).

What I do now is just create a model object and write some functions that perform the logic my application needs, and within those functions are SQL statements (using ADODB's parameterized queries of course). This works though because most of the custom code I'm writing for C5 is relatively small and just one modular piece of the site. If you need to build an entire custom application, C5 is not the right tool for the job.

One project that looks promising is Django CMS (http://www.django-cms.org/ ) -- it is nowhere near as feature-complete as Concrete5, but if you need to build a lot of custom functionality it might be a better fit since it's a lower-level framework and will hence give you more flexibility (at the expense of you having to do more work of course).
internalfx replied on at Permalink Reply
internalfx
yeah....its cool that it has an active record implementation....

I like ADODB's XML schema...it makes managing table layout simple, That is a feature CakePHP could take notice of.

But when it comes to building any custom database apps for the dashboard. C5 just doesn't cut it, imagine needing complicated relationships and trying to use C5 (scary huh?).

A typical CakePHP relationship....
class Address extends AppModel {
var $belongsTo = array('User');
}


There you go.....you just gave yourself the ability to have multiple addresses with each user.

I just wish it was easier to "integrate" frameworks.
andrew replied on at Permalink Reply
andrew
It's true that ADODB's ActiveRecord implementation is somewhat half-baked. That's why we really only use it for simple blocks (for which you don't have to write any database code.) And yeah, we don't really use ActiveRecord much at all in our backend database queries, although the ItemList class in concrete5 can simulate a lot of this stuff – or at the very least make it easier to write a paginated database query with an OOP syntax for filtering, sorting, etc...

If you really want to go the ORM route – without, obviously, leaving behind the excellence and superior CMS that concrete5 offers – you could always include propel or another ORM framework in your app and just reference it in your custom classes.
internalfx replied on at Permalink Reply
internalfx
I checked out propel...it actually looks pretty good....MIT license and everything!

Which begs the question....seeing how these things exist. Why haven't some of these libraries been integrated in C5. I realize that going back and redoing all you database calls is not productive. But what about including the library and using it to accelerate development going forward, slowly overtime migrating to an ORM as new features replace old?

Wouldn't it be to your benefit as much as it would be mine?

I'm sure there is something about the situation I don't know
frz replied on at Permalink Reply
frz
Because managing active open source projects is an exercise in lowest common denominator and unexpected consequences. Feel free to use both together, it's just a matter of time in the day for us
Best wishes
Pecked out on an iPhone