src/User/Service/User.php
public function classifiedAnswer(array $data) 
    {
        $id = isset($data['id']) ? $data['id'] : null;
        
        if(empty($id)) {
            throw new \Exception("Errore si sistema.");
        }
        
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$documentRepository = $main->getDocumentEntityRepository();
		
        $classified = $documentRepository->getEntity($id);
        $classifiedModel = $this->getServiceLocator()->get('document.model.classifiedAdminListing');
        $classifiedModel->init($classified, $this->getServiceLocator());
        
        $form = $this->getServiceLocator()->get('user.form.classifiedanswer');
        $form->setData($data);
        
        if(!$form->isValid()) {
            throw new \Exception(serialize($form->getMessages()));
        }
        $url = $this->getServiceLocator()->get('ControllerPluginManager')->get('Url');
        $data = array_merge($form->getData(), array(
            'siteurl' => $url->fromRoute('home', array(), array('force_canonical' => true)), 
            'to' => $classifiedModel->email, 
            'fullname' => $classifiedModel->fullname,
            'title' => $classifiedModel->title,
            'address' => $classifiedModel->address
        ));
        
        $event = new ClassifiedAnswerEvent(__FUNCTION__, null, $data);
        $this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this, $event);
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, $event);
    }
public function classifiedAnswer(array $data) 
    {
        $id = isset($data['id']) ? $data['id'] : null;
        
        if(empty($id)) {
            throw new \Exception("Errore si sistema.");
        }
        
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$documentRepository = $main->getDocumentEntityRepository();
		
        $classified = $documentRepository->getEntity($id);
        $classifiedModel = $this->getServiceLocator()->get('document.model.classifiedAdminListing');
        $classifiedModel->init($classified, $this->getServiceLocator());
        
        $form = $this->getServiceLocator()->get('user.form.classifiedanswer');
        $form->setData($data);
        
        if(!$form->isValid()) {
            throw new \Exception(serialize($form->getMessages()));
        }
        $url = $this->getServiceLocator()->get('ControllerPluginManager')->get('Url');
        $data = array_merge($form->getData(), array(
            'siteurl' => $url->fromRoute('home', array(), array('force_canonical' => true)), 
            'to' => $classifiedModel->email, 
            'fullname' => $classifiedModel->fullname,
            'title' => $classifiedModel->title,
            'address' => $classifiedModel->address
        ));
        
        $event = new ClassifiedAnswerEvent(__FUNCTION__, null, $data);
        $this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this, $event);
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, $event);
    }
Check if data is valid and dispatch classified answer event

@param array $data
@param string $destination
@throws \Exception