|
From: Nathan D. <na...@ch...> - 2002-11-01 23:57:38
|
I guess I'd rather not have baseContentObject know whether a field is a
contentObject collection or not -- it just seems cleaner to have a field
type that knows how to deal with it. That is, I don't think it makes sense
to abstract "collections" from "fields" -- if a field is a collection that
is the business of the field implementation. Make sense? Am I missing
obvious pitfalls to that?
I absolutely agree that linked components should have to deal with their own
persistence/editing. I think that even in renderSimpleForm() all you would
see is a SELECT that have the id's of the linked fields -- I don't think for
1.0 we should spend any energy trying to "edit a collection as a collection"
(or render it as such) as you suggest.
-----Original Message-----
From: mod...@li...
[mailto:mod...@li...]On Behalf Of Jeremy
Firsenbaum
Sent: Friday, November 01, 2002 2:41 PM
To: mod...@li...
Subject: Re: [Modus-devs] XML descriptor of linked contentObjects, WAS:
Collections of content objects and performance
I think most of the code that I added to basecontentobject to support the
objectArray type can be used for the collection implementation. In fact, the
field type should be easy in comparison.
Correct me if I'm wrong but it looks like adding one conditional to
addField() and getField() in basecontentobject to check for field type would
make this work:
For example, from addField line 422:
if it's a simple value do
thisField.setAttributes(arguments);
if it's a collection do
//collectionAdd() was objectArrayAdd()
collection = this.collectionAdd(arguments.name,
arguments.collectionType, arguments.key)
thisField.setCollection(collection);
I haven't tested this, but if it seems like I'm on the right track I'd be
happy to try it out over the weekend.
Another thought is that I don't see supporting persistence for
collections. I can't imagine needing to edit a collection as a collection.
It would be much simpler to make the persistence calls on individual
collection items.
For example:
post = forums.getCollectionItem('posts', 3)
//make some changes to post, then do
post.store()
How's that sound?
|