如何填充phalcon中表格中的选择选项


How to populate the select options from a table in phalcon?

我在一个表中有一个包含idnamestatus标签的列表,在我的型号TagsStandard中,我有这个:

const STATUS_APPROVED = 1;
const STATUS_DISABLED= 0;
public $id;
public $name;
public $status; 
public static function getAllTag()
{
    $tags = TagsStandard::find(array(
        "status = 'STATUS_APPROVED'",
        "order" => "id"
    ));
}

因此,我得到了所有的标签。现在在indexAction的控制器上,我有:

$tags = TagsStandard::getAllTag();
if ($tags) {
    $this->view->tags = $tags;
    $this->view->name = array("name" => $tags->name->toArray());
}

在我的索引中:

<select id='user-skills-input' class="select-chosen" type="text" data-role="tagsinput" value="" multiple>
   <?php if(count($tags) > 0): ?>
   <?php foreach($tags->items as $idx => $tag): 
       echo "<option value='" . $tag->id . "'> " . $tag->name . "</option>" ?>
   <?php endforeach; ?>
   <?php endif; ?>
</select>

这些值没有显示在选项中,所以有人能帮我吗?

<?php
echo 'Phalcon'Tag::select(array(
    "user-skills-input",
    TagsStandard::find(array(
        "status = 'STATUS_APPROVED'",
        "order" => "id"
    )),
    "using" => array("id", "name")
    );

Phalcon标签#选择