I have the Users table with the following data:
class User extends Entity
{
protected $_virtual = ['createdformated','modifiedformated'];
protected function _getCreatedformated()
{
$date = new Time($this->_properties['created']);
$final=strftime("%d/%m/%Y %H:%M", $date->getTimestamp());
return $final;
}
protected function _getModifiedformated()
{
$date = new Time($this->_properties['modified']);
$final=strftime("%d/%m/%Y %H:%M", $date->getTimestamp());
return $final;
}
}
If in my controller i call:
$logusers["data"] = $this->Logusers->find('all')
->contain(['Users'])
->order(['Logusers.id'=>'DESC']);
echo json_encode($logusers);
And i get the following after the jsonenconde
Warning (512): Unable to emit headers. Headers sent in file=C:\wamp\www\otras\mailing\src\Controller\UsersController.php line=91 [CORE\src\Http\ResponseEmitter.php, line 48]
If i leave only 1(ONE) virtual field, the problem is gone... the problem is only when i enable both of them.
What is the problem???