data not getting inserted using doctrine + zf-Collection of common programming errors
using doctrine 2.0 for the first time with zend framework..
i am just adding one event and the function is as follows..
public function suggesteventAction(){
$form = new Application_Form_Events();
$form->setAction($this->view->url(array('controller' => 'events', 'action' => 'suggestevent')));
//$form->area_of_interest_id->addMultiOptions($this->getInterestListAction());
$this->view->form = $form;
if($this->_request->isPost()){
$formData = $this->getRequest()->getPost();
if($form->isValid($formData)){
$title = $form->getValue('title');
$area_of_interest_id = $form->getValue('area_of_interest_id');
$date_from = $form->getValue('date_from');
$date_to = $form->getValue('date_to');
$venue = $form->getValue('venue');
$company_logo = $form->getValue('logo');
$website = $form->getValue('website');
$email = $form->getValue('email');
$address = $form->getValue('address');
$city = $form->getValue('city');
$state = $form->getValue('state');
$zip = $form->getValue('zip');
$phone = $form->getValue('phone_number');
$short_description = $form->getValue('short_description');
$long_description = $form->getValue('long_description');
$event = new Default_Model_Event;
$event->setTitle($title);
$event->setUser_id(1);
$event->setArea_of_interest_id(1);
$event->setDate_from($date_from);
$event->setDate_to($date_to);
$event->setVenue($venue);
$event->setAddress($address);
$event->setCity($city);
$event->setState($state);
$event->setZip($zip);
$event->setCountry($country);
$event->setCompany_logo($company_logo);
$event->setWebsite($website);
$event->setEmail($email);
$event->setPhone_number($phone);
$event->setStatus('pending');
$event->setShort_description($short_description);
$event->setLong_description($long_description);
$this->_em->persist($event);
$this->_em->flush();
Zend_Debug::dump($this->_em);
die;
$this->view->alert = 'Record saved successfully';
} else {
$form->populate($formData);
}
}
}//end fucntion
now on flush i am getting error.. there is one table for user and area of interest so these two are foreign keys…
/**
* @Entity
* @Table(name="events")
*/
class Default_Model_Event
{
/**
* @Id @Column(name="id", type="integer")
* @GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @Column(name="user_id", type="integer")
*/
private $user_id;
/**
* @Column(name="title", type="string")
*/
private $title;
/**
* @Column(name="area_of_interest_id", type="integer")
*/
private $area_of_interest_id;
/**
* @Column(name="date_from", type="string")
*/
private $date_from;
Column not found: 1054 Unknown column ‘area_of_interest_id’ in ‘field list’
in everything is fine but dont know data is not getting inserted..
Originally posted 2013-11-09 23:10:47.