##// END OF EJS Templates
Update addEvent method to handle correctly DBEventProduct creation
perrinel -
r1278:e1d721ada69c
parent child
Show More
@@ -150,12 +150,22 void CatalogueController::addEvent(std::shared_ptr<DBEvent> event)
150 150 {
151 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 156 // Call update is necessary at the creation of add Event if it has some tags or some event
156 157 // products
157 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 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now