symfony-cmf / simple-cms-bundle

UNMAINTAINED - A more-than-simple cms based on the cmf components
http://cmf.symfony.com/
49 stars 45 forks source link

ensure that children are sorted by date #26

Closed lsmith77 closed 11 years ago

lsmith77 commented 11 years ago

maybe this should be configurable? even so should it be on or off by default? i guess off?

dbu commented 11 years ago

i think a configuration option to enable/disable this would make sense, yes. as for the right default, the date /is/ suggesting some implicit logic - having it on could also make sense. if you do not edit the creation date, it will not matter anyways, right? as new things are always added to the end... or does the re-sorting make new things added at the beginning of the list? while we are at it, we could make the option something like sortByCreation: ASC|DESC|null with null by default.

lsmith77 commented 11 years ago

the sort direction should indeed be configurable. then again i wonder if this shouldnt just be a cookbook entry.

dbu commented 11 years ago

this is now in conflict and can't be merged anymore. we should clean it up and merge.

lsmith77 commented 11 years ago

well I am still not sure if we should provide this by default. I guess if at ask it needs to be configurable

lsmith77 commented 11 years ago

i also wonder if we could be a bit smarter for some edges cases .. especially when adding something with the current date one will usually just need to append to the end. since the collection is lazy loaded, we could maybe get the keys and check the date of the last item and compare it to the edited item to see if we need to do anything.

furthermore .. i wonder if we could turn this sort by date into more of a "behavior" that one could easily reuse anywhere.

dbu commented 11 years ago

ok, i made things optional and fixed the actual sorting algorithm to use the collection. i am a bit unsure why we need the nested sorting and all that though. if it makes sense like this, i propose we merge and refactor later if we want to reuse it, or optimize - it will not create a bc break for users of simplecms if we move the functionality into a common core.