Hi le51,
The variable is not empty because I use a var_dump($institucion) in this View (listar.volt) and it devolve a array. I show here:
object(Phalcon\Mvc\Model\Resultset\Simple)[51]
protected '_type' => int 0
protected '_result' =>
object(Phalcon\Db\Result\Pdo)[52]
protected '_connection' =>
object(Phalcon\Db\Adapter\Pdo\Postgresql)[46]
protected '_eventsManager' => null
protected '_descriptor' =>
array (size=4)
...
protected '_dialect' =>
object(Phalcon\Db\Dialect\Postgresql)[48]
...
protected '_connectionId' => int 1
protected '_sqlStatement' => null
protected '_sqlVariables' => null
protected '_sqlBindTypes' => null
protected '_transactionsWithSavepoints' => int 0
protected '_pdo' =>
object(PDO)[47]
...
protected '_affectedRows' => null
protected '_transactionLevel' => int 0
protected '_type' => string 'pgsql' (length=5)
protected '_dialectType' => string 'postgresql' (length=10)
protected '_result' => null
protected '_fetchMode' => int 2
protected '_pdoStatement' =>
object(PDOStatement)[53]
public 'queryString' => string 'SELECT "institucion"."id_institucion", "institucion"."rif", "institucion"."nombre", "institucion"."tipo" FROM "institucion"' (length=123)
protected '_sqlStatement' => string 'SELECT "institucion"."id_institucion", "institucion"."rif", "institucion"."nombre", "institucion"."tipo" FROM "institucion"' (length=123)
protected '_bindParams' => null
protected '_bindTypes' => null
protected '_rowCount' => int 2
protected '_cache' => null
protected '_isFresh' => boolean true
protected '_pointer' => int -1
protected '_count' => int 2
protected '_activeRow' => null
protected '_rows' => null
protected '_errorMessages' => null
protected '_hydrateMode' => int 0
protected '_model' =>
object(Institucion)[45]
public 'id_institucion' => null
public 'rif' => null
public 'nombre' => null
protected '_dependencyInjector' =>
object(Phalcon\DI\FactoryDefault)[5]
public '_services' =>
array (size=24)
...
public '_sharedInstances' =>
array (size=8)
...
public '_freshInstance' => boolean true
protected '_modelsManager' =>
object(Phalcon\Mvc\Model\Manager)[43]
protected '_dependencyInjector' =>
object(Phalcon\DI\FactoryDefault)[5]
...
protected '_eventsManager' => null
protected '_customEventsManager' => null
protected '_readConnectionServices' => null
protected '_writeConnectionServices' => null
protected '_aliases' => null
protected '_hasMany' => null
protected '_hasManySingle' => null
protected '_hasOne' => null
protected '_hasOneSingle' => null
protected '_belongsTo' => null
protected '_belongsToSingle' => null
protected '_hasManyToMany' => null
protected '_hasManyToManySingle' => null
protected '_initialized' =>
array (size=1)
...
protected '_sources' =>
array (size=1)
...
protected '_schemas' => null
protected '_behaviors' => null
protected '_lastInitialized' =>
&object(Institucion)[45]
protected '_lastQuery' => null
protected '_reusable' => null
protected '_keepSnapshots' => null
protected '_dynamicUpdate' => null
protected '_namespaceAliases' => null
protected '_modelsMetaData' => null
protected '_errorMessages' => null
protected '_operationMade' => int 0
protected '_dirtyState' => int 1
protected '_transaction' => null
protected '_uniqueKey' => null
protected '_uniqueParams' => null
protected '_uniqueTypes' => null
protected '_skipped' => null
protected '_related' => null
protected '_snapshot' => null
protected '_columnMap' => null
protected '_keepSnapshots' => boolean false
So, If I detele this view (listar.volt) and print variable in the controller (InstitucionController.php) on this way, it's all right:
$institucion = institucion::find();
foreach ($institucion as $obj) {
echo $obj->nombre." - ".$obj->rif."<br>";
}
But I need print variable in the view not in controller. I think which problem can be in how pass variable to the "View".
Error: Notice: Access to undefined property Institucion::name in C:\wamp\www\sistema_vit\cache\volt\c%%%%wamp%%www%%sistema_vit%%app%%views%%institucion%%listar.volt.php on line 23