protected function doCreateObject(array $array) { $obj = new \woo\domain\Space($array['id']); $obj->setname($array['name']); $ven_mapper = new VenueMapper(); $venue = $ven_mapper->find($array['venue']); $obj->setVenue($venue); $event_mapper = new EventMapper(); $event_collection = $event_mapper->findBySpaceId($array['id']); $obj->setEvents($event_collection); return $obj; }
function doExecute(\woo\controller\Request $request) { $venue = $request->getObject("venue"); if (!isset($venue)) { $venue = \woo\domain\Venue::find($request->getProperty('venue_id')); } if (is_null($venue)) { $request->addFeedback("unable to find venue"); return self::statuses('CMD_ERROR'); } $request->setObject("venue", $venue); $name = $request->getProperty("space_name"); if (!isset($name)) { $request->addFeedback("please add name for the space"); return self::statuses('CMD_INSUFFICIENT_DATA'); } else { $venue->addSpace($space = new \woo\domain\Space(null, $name)); $request->addFeedback("space '{$name}' added ({$space->getId()})"); return self::statuses('CMD_OK'); } }