I have two Phalcon\Mvc\Model (Users, Cities). Every user has a city, so the Users model has a hasOne relationship (alias = City).
$User = Users::findFirst($user_id);
$name = $User->name;
$name = $User->name;
$name = $User->name;
The above code is ok, because Phalcon runs only one query to the database.
$User = Users::findFirst($user_id);
$city = $User->City->name;
$city = $User->City->name;
$city = $User->City->name;
The above code runs 3 query. Everytime I try to get a value from Cities Phalcon runs the same query again. Why?
Phalcon 1.3.2
PHP 5.5.9
PostgreSQL 9.3.4