commit
7b98ca54a8
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Model;
|
||||
use Entity\Quote;
|
||||
use Gateway\QuoteGateway;
|
||||
|
||||
class QuoteModel
|
||||
{
|
||||
private QuoteGateway $gateway;
|
||||
|
||||
public function __construct(QuoteGateway $gate){
|
||||
$this->gateway = $gate;
|
||||
}
|
||||
|
||||
public function searchId(int $id): Quote{
|
||||
$res = $this->gateway->searchId($id);
|
||||
if( count($res) == 0)
|
||||
return new Quote(-1,"NULL","NULL","NULL","NULL","NULL",0,"Default");
|
||||
else
|
||||
return new Quote($res[0]["id_quote"],$res[0]["content"],$res[0]["caracter"],$res[0]["imgpath"],$res[0]["title"],$res[0]["dates"],$res[0]["likes"],$res[0]["langue"]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace Model;
|
||||
use Entity\Quote;
|
||||
use Gateway\QuoteGateway;
|
||||
|
||||
class QuoteModel
|
||||
{
|
||||
private QuoteGateway $gateway;
|
||||
|
||||
public function __construct(QuoteGateway $gate){
|
||||
$this->gateway = $gate;
|
||||
}
|
||||
|
||||
public function searchId(int $id): Quote{
|
||||
$res = $this->gate->searchId($id)[0];
|
||||
return new Quote($res["q.id_quote"],$res["q.content"],$res["c.caracter"],$res["c.img_path"],$res["s.title"],$res["s.date"],$res["q.like"],$res["q.language"]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue