I'm trying to get the values from the database and display on the screen, however it 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 noticed that this error is displayed when I try to display the date value.
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 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 ideas?