* fix on event publication process.
This commit is contained in:
Sebastian Marcet 2014-11-27 19:49:30 -03:00
parent 82e52e12c6
commit b08cab3c56
4 changed files with 11 additions and 7 deletions

View File

@ -90,6 +90,8 @@ final class EventRegistrationRequestFactory
$event = new EventPage; $event = new EventPage;
$event->Title = $request->Title; $event->Title = $request->Title;
$event->ClassName = 'EventPage';
$event->ParentID = 41;
$event->EventLink = $request->Url; $event->EventLink = $request->Url;
$event->EventLinkLabel = $request->Label; $event->EventLinkLabel = $request->Label;
$event->EventStartDate = $request->StartDate; $event->EventStartDate = $request->StartDate;

View File

@ -26,6 +26,6 @@ final class SapphireEventPublishingService implements IEventPublishingService {
if(!$parent) throw new NotFoundEntityException('EventHolder',''); if(!$parent) throw new NotFoundEntityException('EventHolder','');
$event->setParent($parent); // Should set the ID once the Holder is created... $event->setParent($parent); // Should set the ID once the Holder is created...
$event->write(); $event->write();
//$event->doPublish(); $event->doPublish();
} }
} }

View File

@ -116,13 +116,12 @@ final class EventRegistrationRequestManager {
$event_repository = $this->event_repository; $event_repository = $this->event_repository;
$event_publishing_service = $this->event_publishing_service; $event_publishing_service = $this->event_publishing_service;
return $this->tx_manager->transaction(function() use ($id, $repository, $event_repository, $factory, $event_publishing_service, $event_link){ $event = $this->tx_manager->transaction(function() use ($id, $repository, $event_repository, $factory, $event_publishing_service, $event_link){
$request = $repository->getById($id); $request = $repository->getById($id);
if(!$request) throw new NotFoundEntityException('EventRegistrationRequest',sprintf('id %s',$id )); if(!$request) throw new NotFoundEntityException('EventRegistrationRequest',sprintf('id %s',$id ));
$event = $factory->buildEvent($request); $event = $factory->buildEvent($request);
$event_repository->add($event); $event_repository->add($event);
$request->markAsPosted(); $request->markAsPosted();
$event_publishing_service->publish($event);
//send Accepted message //send Accepted message
$point_of_contact = $request->getPointOfContact(); $point_of_contact = $request->getPointOfContact();
@ -139,6 +138,9 @@ final class EventRegistrationRequestManager {
return $event; return $event;
}); });
$event_publishing_service->publish($event);
return $event;
} }
public function updateEventRegistrationRequest(array $data){ public function updateEventRegistrationRequest(array $data){

View File

@ -50,21 +50,21 @@ class EventHolder_Controller extends Page_Controller {
} }
function PastEvents($num = 4) { function PastEvents($num = 4) {
return EventPage::get()->filter(array('EventEndDate:LessThanOrEqual'=>'now()', 'IsSummit'=>1))->sort('EventEndDate')->limit($num); return EventPage::get()->filter(array('EventEndDate:LessThanOrEqual'=> date('Y-m-d') , 'IsSummit'=>1))->sort('EventEndDate')->limit($num);
} }
function FutureEvents($num) { function FutureEvents($num) {
return EventPage::get()->filter(array('EventEndDate:GreaterThanOrEqual'=>'now()'))->sort('EventStartDate','ASC')->limit($num); return EventPage::get()->filter(array('EventEndDate:GreaterThanOrEqual'=> date('Y-m-d') ))->sort('EventStartDate','ASC')->limit($num);
} }
function PastSummits($num) { function PastSummits($num) {
return EventPage::get()->filter(array('EventEndDate:LessThanOrEqual'=>'now()', 'IsSummit'=>1))->sort('EventEndDate','DESC')->limit($num); return EventPage::get()->filter(array('EventEndDate:LessThanOrEqual'=> date('Y-m-d') , 'IsSummit'=>1))->sort('EventEndDate','DESC')->limit($num);
} }
function FutureSummits($num) { function FutureSummits($num) {
return EventPage::get()->filter(array('EventEndDate:GreaterThanOrEqual'=>'now()', 'IsSummit'=>1))->sort('EventStartDate','ASC')->limit($num); return EventPage::get()->filter(array('EventEndDate:GreaterThanOrEqual'=> date('Y-m-d') , 'IsSummit'=>1))->sort('EventStartDate','ASC')->limit($num);
} }
public function getEvents($num = 4, $type) { public function getEvents($num = 4, $type) {