##// END OF EJS Templates
Update addEvent method to handle correctly DBEventProduct creation
perrinel -
r1213:ada4b87f10f3
parent child
Show More
@@ -150,12 +150,22 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event)
150 {
150 {
151 event->setRepository(impl->toWorkRepository(event->getRepository()));
151 event->setRepository(impl->toWorkRepository(event->getRepository()));
152
152
153 impl->m_CatalogueDao.addEvent(*event);
153 auto eventTemp = *event;
154 impl->m_CatalogueDao.addEvent(eventTemp);
154
155
155 // Call update is necessary at the creation of add Event if it has some tags or some event
156 // Call update is necessary at the creation of add Event if it has some tags or some event
156 // products
157 // products
157 if (!event->getEventProducts().empty() || !event->getTags().empty()) {
158 if (!event->getEventProducts().empty() || !event->getTags().empty()) {
158 impl->m_CatalogueDao.updateEvent(*event);
159
160 auto eventProductsTemp = eventTemp.getEventProducts();
161 auto eventProductTempUpdated = std::list<DBEventProduct>{};
162 for (auto eventProductTemp : eventProductsTemp) {
163 eventProductTemp.setEvent(eventTemp);
164 eventProductTempUpdated.push_back(eventProductTemp);
165 }
166 eventTemp.setEventProducts(eventProductTempUpdated);
167
168 impl->m_CatalogueDao.updateEvent(eventTemp);
159 }
169 }
160 }
170 }
161
171
General Comments 0
You need to be logged in to leave comments. Login now