1
I’m trying to bring the values of the database and present on the screen though he gives me the following error message:
ErrorException in helpers.php line 531:
htmlentities() expects parameter 1 to be string, object given (View: /var/www/resources/views/contas/index.blade.php)
I realized that this error is presented when I try to present the value of dates.
Function:
public function Index(EntityManagerInterface $em)
{
$FinContaspagar = $em->getRepository(FinContaspagar::class)->findAll();
return view('contas.index', [ 'FinContaspagar' => $FinContaspagar ]);
}
Index:
@extends('master')
@section('content')
<div class="row">
<div class="col-md-12">
<h3>Contas cadastradas</h3>
<table class="table table-striped">
<tr>
<th>Grupo</th>
<th>Estabelecimento</th>
<th>Terceiro</th>
<th>Codigo</th>
<th>Data de Emissão</th>
<th>Data de Vencimento</th>
</tr>
@forelse($FinContaspagar as $contas)
<tr>
<td>{{ $contas->getGrupo() }}</td>
<td>{{ $contas->getEstabelecimento() }}</td>
<td>{{ $contas->getTerceiro() }}</td>
<td>{{ $contas->getCodigo() }}</td>
<td>{{ $contas->getDtemissao() }}</td>
<td>{{ $contas->getDtvencimento() }}</td>
</tr>
@empty
<tr>
<td colspan="5">Não há ações neste momento!</td>
</tr>
@endforelse
</table>
</div>
</div>
@endsection
If I give a print_r($FinContaspagar)
, I get the values:
[0] => ModuloFinanceiro\Entities\FinContaspagar Object
(
[grupo:ModuloFinanceiro\Entities\FinContaspagar:private] => 1
[estabelecimento:ModuloFinanceiro\Entities\FinContaspagar:private] => 1
[terceiro:ModuloFinanceiro\Entities\FinContaspagar:private] => 1
[codigo:ModuloFinanceiro\Entities\FinContaspagar:private] => 1
[dtemissao:ModuloFinanceiro\Entities\FinContaspagar:private] => DateTime Object
(
[date] => 2017-04-11 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
[dtvencimento:ModuloFinanceiro\Entities\FinContaspagar:private] => DateTime Object
(
[date] => 2017-04-11 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
)
Any idea?
I did this test within the function, forgot to perform within the index. Thank you very much!
– Felipe Nunes