public function add(Operation $operation) { $query = $this->_db->prepare('INSERT INTO t_operation (date, montant, modePaiement, idContrat, numeroCheque) VALUES (:date, :montant, :modePaiement,:idContrat, :numeroCheque)') or die(print_r($this->_db->errorInfo())); $query->bindValue(':date', $operation->date()); $query->bindValue(':montant', $operation->montant()); $query->bindValue(':modePaiement', $operation->modePaiement()); $query->bindValue(':idContrat', $operation->idContrat()); $query->bindValue(':numeroCheque', $operation->numeroCheque()); $query->execute(); $query->closeCursor(); }
public function update(Operation $operation) { $query = $this->_db->prepare('UPDATE t_operation SET date=:date, dateReglement=:dateReglement, compteBancaire=:compteBancaire, montant=:montant, modePaiement=:modePaiement, observation=:observation, numeroCheque=:numeroCheque, updated=:updated, updatedBy=:updatedBy WHERE id=:id') or die(print_r($this->_db->errorInfo())); $query->bindValue(':id', $operation->id()); $query->bindValue(':date', $operation->date()); $query->bindValue(':dateReglement', $operation->dateReglement()); $query->bindValue(':compteBancaire', $operation->compteBancaire()); $query->bindValue(':observation', $operation->observation()); $query->bindValue(':montant', $operation->montant()); $query->bindValue(':modePaiement', $operation->modePaiement()); $query->bindValue(':numeroCheque', $operation->numeroCheque()); $query->bindValue(':updated', $operation->updated()); $query->bindValue(':updatedBy', $operation->updatedBy()); $query->execute(); $query->closeCursor(); }