Mapping for multiple date/time

4 views
Skip to first unread message

Olivier Revollat

unread,
Aug 26, 2015, 10:48:47 AM8/26/15
to PHPCR User Group Mailinglist
Hi,

I'm using Symfony CMF to build a site who show events and they can have multiple date/time I'm pretty new to phpcr i'm wondering which kind of mapping should I use (multivalue? childrens ? ReferenceMany ?)
the goal is that it should be easy to query/filter the events documents by date ...

thanks for your help !

David Buchmann

unread,
Aug 26, 2015, 11:00:31 AM8/26/15
to phpcr...@googlegroups.com
hi olivier,

sorry for only replying now, the message ended up in my spam folder :-(

i would use references sparingly, try to avoid them for queries you run
often. compared to sql databases, joins are more expensive with PHPCR.

if you have a collection of specific dates, multivalue sounds the most
natural for this.
i recommend to experiment with the query, but as i understood, you can
query a multivalue field like a single field and if the condition is
true for one of the values the node would be in the result set.

if you have timespans and want to query for being *within* one of the
timespans this won't work as the multivalue start date field and
multivalue end date field would not be connected, so anything between
the earliest start date and the last end date would match. in that case
i would go with child documents and join with the children for the query.

if there is frequency like every week or every first sunday of the
month, you would probably need to build some system that creates entries
referencing the event description. maybe copy the things you need on the
search result page into the date-entries (yes, duplication) to avoid the
need to join dozens of event occurences with the event description document.

i hope this helps,
david

On 19.08.2015 10:15, Olivier Revollat wrote:
> Hi,
>
> I'm using Symfony CMF to build a site who show events and they can have
> */multiple date/time/* I'm pretty new to phpcr i'm wondering which kind
> of mapping should I use (multivalue? childrens ? ReferenceMany ?)
> the goal is that it should be /*easy to query/filter*/ the events
> documents by date ...
>
> thanks for your help !
>
> --
> You received this message because you are subscribed to the Google
> Groups "PHPCR User Group Mailinglist" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to phpcr-users...@googlegroups.com
> <mailto:phpcr-users...@googlegroups.com>.
> To post to this group, send email to phpcr...@googlegroups.com
> <mailto:phpcr...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/phpcr-users.
> For more options, visit https://groups.google.com/d/optout.

--
Liip AG // Agile Web Development // T +41 43 500 39 80
CH-8005 Zurich // PGP 0xA581808B // www.liip.ch
Reply all
Reply to author
Forward
0 new messages