Liste d'objet
Posté : 26 févr. 2017, 20:12
Bonjour à tous,
Pourriez vous m'aider, j'aimerais ajouter un attribut contentInvocie à ma classe:
Ici contentInvoice représente une ligne d'une facture (désignation, prix ...) par contre une facture en à plusieurs, je dois utiliser une liste ou un tableau pour cette attribut? Comment je fais pour manipuler les données?
Merci de votre aide.
Pourriez vous m'aider, j'aimerais ajouter un attribut contentInvocie à ma classe:
Code : Tout sélectionner
<?php
namespace Model;
class Invoice{
private $_number;
private $_date;
private $_buyer;
private $_contentInvoice;
private $_total;
public function __construct(){
}
public function getNumber(){
return $this->_number;
}
public function setNumber($number){
if(is_int($number)){
$this->_number = $number;
}
}
public function getDate(){
return $this->_date;
}
public function setDate($newDate){
$this->_date = $newDate;
}
public function getBuyer(){
return $this->_buyer;
}
public function setBuyer(Buyer $buyer){
if($buyer instanceof 'Buyer'){
$this->_buyer = $buyer;
}
}
public function getTotal(){
return $this->_total;
}
public function setTotal($total){
$this->_total = $total;
}
public function getContentInvoice(){
return $this->_contentInvoice;
}
public function setContentInvoice(ContentInvoice $contentInvoice){
if($contentInvoice instanceof 'ContentInvoice'){
$this->_contentInvoice = $contentInvoice;
}
}
}
Merci de votre aide.