Exemple #1
0
	public function save(Pment_Models_Cp $cp)
	{
		$data = array(
			'cpId' => $cp->getCpId(),
			'contractorId' => $cp->getContractorId(),
			'projectId' => $cp->getProjectId()
		);
		if (null === ($id = $cp->getCpId())) {
			unset($data['cpId']);
			return $this->getDbTable()->insert($data);
		} else {
			return $this->getDbTable()->update($data, array('cpId = ?' => $cp->getCpId()));
		}
	}