You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WF-Website/src/Model/SearchModel.php

24 lines
743 B

<?php
namespace Model;
use Entity\Quote;
use Gateway\QuoteGateway;
use Gateway\Gateway;
use Enum\TypeSourceEnum;
class SearchModel extends Model
{
public function searchQuote(?string $type,?string $search,array $filtre): array{
$res = $this->gateway->search($type,$search,$filtre);
$tabQ=[];
foreach($res as $q ){
$q["content"] = (strlen($q["content"]) > 153) ? substr($q["content"],0,150).'...' : $q["content"];
$tabQ[]= new Quote($q["id_quote"],$q["content"],$q["caracter"],$q["imgpath"],$q["title"],$q["dates"],$q["likes"],$q["langue"],TypeSourceEnum::Movie) ;
}
return $tabQ;
}
}
?>