public function fetchLocation(AnCommandContext $context)
   {
       $data = $context->data;

       if($data->location_id){
           $attr = array('id' => $data->location_id);
       } else {
           $attr = array(
              'latitude' => $data->latitude,
              'longitude' => $data->longitude,
              'name' => $data->name,
              'address' => $data->address,
              'city' => $data->city,
              'state_province' => $data->state_province,
              'country' => $data->country,
              'postalcode' => $data->postalcode
           );
       }

       $this->_location = $this->getService('repos:locations.location')->findOrAddNew($attr);

       return $this->_location;
   }
public function fetchLocation(AnCommandContext $context)
   {
       $data = $context->data;

       if($data->location_id){
           $attr = array('id' => $data->location_id);
       } else {
           $attr = array(
              'latitude' => $data->latitude,
              'longitude' => $data->longitude,
              'name' => $data->name,
              'address' => $data->address,
              'city' => $data->city,
              'state_province' => $data->state_province,
              'country' => $data->country,
              'postalcode' => $data->postalcode
           );
       }

       $this->_location = $this->getService('repos:locations.location')->findOrAddNew($attr);

       return $this->_location;
   }
public function fetchLocation ( AnCommandContext $ context ) { $ data = $ context -> data ; if ( $ data -> location_id ) { $ attr = array ( 'id' => $ data -> location_id ) ; } else { $ attr = array ( 'latitude' => $ data -> latitude , 'longitude' => $ data -> longitude , 'name' => $ data -> name , 'address' => $ data -> address , 'city' => $ data -> city , 'state_province' => $ data -> state_province , 'country' => $ data -> country , 'postalcode' => $ data -> postalcode ) ; } $ this -> _location = $ this -> getService ( 'repos:locations.location' ) -> findOrAddNew ( $ attr ) ; return $ this -> _location ; }
Method to fetch or create a location enitty

@param AnCommandContext $context
@return ComLocationsDomainEntityLocation entity
Method to fetch or create a location enitty