実行すると、このエラーが発生します:
$db = new PDO('mysql:host=localhost;dbname=MYDATABASE', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$Manager = new CompanyManager($db);
$Manager->getList();
エラー :
Warning: Missing argument 2 for Company::__construct(), called in /.../CompanyManager.class.php on line 53 and defined in /.../Company.class.php on line 17
これがCompanyManager.class.phpの一部です:
public function getList()
{
$Company = array();
$q = $this->_db->query('SELECT id, statut, company, activity, source, secteur, comments, offer_date, entry_date, type_ope, gestionnaire, next_step FROM prospect ORDER BY id');
while ($donnees = $q->fetch(PDO::FETCH_ASSOC))
{
$Company[] = new Company($donnees);
}
return $Company;
}
そしてここにCompany.class.php(興味深い部分)があります:
<?php
class Company
{
private $_id;
private $_statut;
private $_company;
private $_activity;
private $_source;
private $_secteur;
private $_comments;
private $_offerDate;
private $_entryDate;
private $_typeOpe;
private $_gestionnaire;
private $_nextStep;
public function __construct($id, $statut, $company, $activity, $source, $secteur, $comments, $offerDate, $entryDate, $typeOpe, $gestionnaire, $nextStep)
{
$this->setId($id);
$this->setStatut($statut);
$this->setCompany($company);
$this->setActivity($activity);
$this->setSource($source);
$this->setSecteur($secteur);
$this->setComments($comments);
$this->setOfferDate($offerDate);
$this->setEntryDate($entryDate);
$this->setTypeOpe($typeOpe);
$this->setGestionnaire($gestionnaire);
$this->setNextStep($nextStep);
}
私に手を差し伸べようとするすべての人に大いに感謝します;-)