Joomla framework method setQuery builds and populate the object automagically
Joomla! Help Site - [REVIEW] database->loadObject
Properties also known as object vars
PHP: get_object_vars - Manual
The problem is that object var names are taken directly from database field names, and database field names have the minus character inside the name like "COD-NOMINA".
$consulta = "SELECT * FROM tmp_aportes WHERE `COD-NOMINA`='3108801'";
$db->setQuery($consulta);
$aportes = $db->loadObject();
So it is necesary to escape those characters to avoid php attemps to operate a substraction (-) when evaluates the code
for example in this code
echo $aportes->COD-NOMINA ;
because if is not escaped php checks for a "property" $aportes->COD instead the required $aportes->COD-NOMINA
Thanks for any ideas.