[SOLVED] Using Volt incombination with Hasmany

Hello Everyone,

I'm kinda new to phalconphp, but so far I'm loving it!

My question relates to http://docs.phalconphp.com/en/latest/reference/models.html#defining-relationships where models are created that used database relationships to get additional information.

I want to show the related information aswell, but all I can think off to show it in volt is like this:

<div class="row"> {% for Robot in Robots %} <?php
$RobotsParts = $Robot->RobotsParts; foreach($RobotsParts as $RobotsPart){ $Parts = $RobotsParts->Parts; echo "-".$tags->$Parts."<br />"; } ?> </div> {% endfor %} </div> is this the most prefered way or is their an easier one?


Hi Again,

I allready figured it out... In order to show the relations you created in the models using hasMany and belongsTo in volt it's rather simple:

<div class="row">
  {% for Robot in Robots %}
  <div class="col-md-4"><h3>{{ Robot.name }}</h3>      
    {% for RobotsParts in Robot.RobotsParts %}
    * {{ RobotsParts.Parts.name }} <br />
    {% endfor %}
  {% endfor %}