Hi, I am creating an Event Management plugin and have a problem with hydrating my events for one day.
My idea is to have a plgMasterEvent class that holds reaccurring events and an actual plgEvent class that holds actual events - as soon as someone is attending an event, a plgEvent instance is created and stored in the database. When displaying one day, I need the following events: 1. all plgEvent's of that day 2. all plgMasterEvent'd that are valid for that day and the results have to be merged in the sense that they need to be sorted by start_time. 1. is easy enough This is the schema.yml: plgEvent: tableName: plg_events actAs: Sluggable: unique: true columns: id: { type: integer(4), primary: true, autoincrement: true } name: { type: string(255), notnull: true } plg_master_event_id: integer(4) event_start: { type: date, notnull: true } event_end: { type: date, notnull: true } start_time: { type: time, notnull: true } end_time: { type: time, notnull: true } comment: text relations: Master: { class: plgMasterEvent, local: plg_master_event_id, foreignType: one } Type: { class: plgType, foreignType: one, local: type_id } plgMasterEvent: tableName: plg_master_events actAs: Sluggable: unique: true fields: [ name ] canUpdate: true columns: id: { type: integer(4), primary: true, autoincrement: true } name: { type: string(255), notnull: true } valid_start: { type: datetime, notnull: true } valid_end: { type: datetime } start_time: { type: time, notnull: true } end_time: { type: time, notnull: true } reaccurance_id: { type: integer(4), notnull: true, default: 1 } relations: Event: { class: plgEvent, foreignType: one, local: id, foreign: plg_master_event_id } Reaccurance: { class: plgReaccurance, local: reaccurance_id, foreign: id, foreignType: one } Days: { class: plgDay, refClass: plgReaccuranceDay, local: master_id, foreign: day_id, foreignType: many } plgReaccurance: tableName: plg_reaccurances actAs: Sluggable: unique: true fields: [ name ] canUpdate: true columns: id: { type: integer(4), primary: true, autoincrement: true } name: { type: string(255), notnull: true } relations: Event: { class: plgMasterEvent, local: id, foreign: reaccurance_id, foreignType: many } plgReaccuranceDay: tableName: plg_reaccurance_days columns: master_id: { type: integer(4), notnull: true } day_id: { type: integer(4), notnull: true } relations: Day: { class: plgDay, local: day_id, foreign: id } Master: { class: plgMasterEvent, local: master_id, foreign: id } plgDay: tableName: plg_days columns: id: { type: integer(4), primary: true, autoincrement: true } name: { type: string(255), notnull: true } php_n: { type: integer(1), notnull:true; } relations: Events: { refClass: plgEventDay, local: day_id, foreign: event_id, foreignType: many } If I have a certain day, the valid plgMasterEvent's can easily be retrieved: $master = $this->createQuery() ->where('valid_start <= ?', $date) ->addWhere('IF("0000-00-00 00:00:00" = valid_end, 1, IF(ISNULL(valid_end), 1, valid_end >= ?))', $date) ->orderBy('start_time ASC') ->execute(); As you can see the plgMasterEvent can be constrained to a number of weekdays but how can I get all valid plgMasterEvent's if I have that weekday? (the field phpN relates to date('N')) My real problem is how to order the resulting two Doctrine_Collections so that the events are ordered according to the start_time. I have tried a RawSQL UNION, but that doesn't hydrate the objects. Any ideas? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en