Hi,
I just started with Phalcon and coding and I am stuck with a little problem. I am trying to count objects in my view but I am unable to do so, so I ask for help here.
Basically I have 3 models : Series, Episodes and Subtitles.
Relations are as follow :
Series :
$this->hasMany('id', 'Episodes', 'series_id', array('alias' => 'Episodes'));
Episodes:
$this->hasMany('id', 'Subtitles', 'episodes_id', array('alias' => 'Subtitles'));
$this->belongsTo('series_id', 'Series', 'id', array('alias' => 'Series'));
Subtitles :
$this->belongsTo('episodes_id', 'Episodes', 'id', array('alias' => 'Episodes'));
In my SeriesController :
$series = Series::find();
$this->view->series = $series;
Then in the view I display series episodes like this :
{% for serie in series %}
{% for episode in serie.Episodes %}
{{ episode.title }}
{% endfor %}
{% endfor %}
What I want is episode count per serie. I am unable to find a way to do so.
Thanks for your help.