Warning: strpos() expects parameter 1 to be string, array given in
Bonjour
j'essaye d'afficher mes images uploadée via cette template Twig:
Code:
1 2 3 4
| <img src="{{ asset(entity.getWebPath("$arrPaths['file1']")) }}" />
<img src="{{ asset(entity.getWebPath("$arrPaths['file2']")) }}" />
<img src="{{ asset(entity.getWebPath("$arrPaths['file3']")) }}" />
<img src="{{ asset(entity.getWebPath("$arrPaths['file4']")) }}" /> |
Et cela depuis ce modèle :
Code:
1 2 3 4 5 6 7 8 9 10
| public function getWebPath()
{
$arrPaths = array();
$arrPaths['file1'] = null === $this->file1 ? null : $this->getUploadDir(). $this->file1;
$arrPaths['file2'] = null === $this->file2 ? null : $this->getUploadDir(). $this->file2;
$arrPaths['file3'] = null === $this->file3 ? null : $this->getUploadDir(). $this->file3;
$arrPaths['file4'] = null === $this->file4 ? null : $this->getUploadDir(). $this->file4;
return $arrPaths;
} |
Par la suite j'ai cette erreur :
Code:
1 2
|
An exception has been thrown during the rendering of a template ("Warning: strpos() expects parameter 1 to be string, array given in /Symfony/vendor/symfony/src/Symfony/Component/Templating/Asset/PathPackage.php line 47") in ::base.html.twig at line 10. |
Quelqu'un peut m'aider a débugger ce soucis.
En vous remerciant d'avance.