0

Zend フレームワーク 2 を使用しています。モデル内の関数を zend フォームから呼び出したいと考えています。

状況は、コンボボックスを持っていて、データベースからデータをバインドしてオプションと値を入力する必要があるということです。

これは zend 形式の私の select タグです

$this->add(array(

    'name' => 'ddlcountry',

    'type' => 'Zend\Form\Element\Select',

    'options' => array(

        'label' => 'Country',

        'value_options' => (here I've to call function),

    ),

));

この値のオプションでは、以下のモデルにある関数を呼び出したいのですが、モデルの関数は次のとおりです。

public function fetchcountry()
{

    $this->adapter = $this->getServiceLocator()->get('db');

    $dbAdapterConfig = $this->adapter;       

    $dbAdapter = $dbAdapterConfig;        

    $driver = $dbAdapter->getDriver();

    $connection = $driver->getConnection();

    $result = $connection->execute("CALL sp_showcountry()");

    $statement = $result->getResource();

    $resultdata = $statement->fetchAll(\PDO::FETCH_OBJ);

    return $resultdata;
}
4

1 に答える 1

2

このような質問を書く前に、このページの最初の 10 個の質問を確認してください。あなたの質問は最近数回尋ねられています ;)

ここに記載されている私の回答を参照してください。

または、問題を詳しく説明している私のブログ投稿を参照してください。

于 2013-04-17T05:36:19.507 に答える