public static function fetch($id = null) { $campaign = new Tg_Campaign(); if (is_null($id)) { return $campaign; } $campaignTable = $campaign->_getCampaignTable(); $rowset = $campaignTable->find($id); $campaign->load($rowset->current()); return $campaign; }
private function _loadFromForm(Zend_Form $form) { $sessionId = $form->id->getValue(); if (!empty($sessionId)) { $this->id = $sessionId; } $campaignId = $form->campaign->id->getValue(); if (!empty($campaignId)) { $this->campaign = Tg_Campaign::fetch($campaignId); } else { $this->campaign = Tg_Campaign::fetch(); } $this->campaign->load($form->campaign); $this->date = new Zend_Date($form->date->getValue()); $this->description = $form->description->getValue(); $this->synopsis = $form->synopsis->getValue(); //todo media //todo author $this->tags = explode(',', $form->tags->getValue()); $this->_sessionForm = $form; }