あなたの関係は(私はあなたがこれを許可するようにsymfonyでは何もする必要がある場合はわからない)が正しく設定されている場合は、あなただけのカテゴリを持つJobeetのチュートリアルのような何かをするだろう...
あなたがexecuteIndexを持っているジョブのactions.class.phpファイルに$ this-> categories = JobeetCategoryPeer :: getWithJobs();があります。
これはモデルJobeetCategoryPeerを見つけてそのモデルでgetWithJobs()関数を呼び出し、そのデータをジョブコントローラに戻して$ categoriesとしてビューに送信することです。
JobeetArticlesPeerに必要なデータを返す関数を作成するので、あなたは、似た何かをしたいと思う...
static public function getArticles()
{
$criteria = new Criteria();
//whatever criteria you want in here
return self::doSelect($criteria);
}
そして、あなたのJobeetJobののactions.class.phpファイル内
のようなものJobeetJob
<?php foreach ($articles as $article): ?>
<div class="article">
<div class="article_title">
<h1>
<?php echo link_to($article, 'article', $article) ?>
</h1>
<?php echo $article->getAuthor() //field name for author ?>
</div>
<div class="article_content">
<?php echo $article->getContent() //field name for article content ?>
</div>
</div>
<?php endforeach; ?>
とTのためのあなたのindexSuccess.phpとで
public function executeIndex(sfWebRequest $request)
{
$this->articles = JobeetArticlesPeer::getArticles();
}
そして最後に帽子は、他のモデルからデータにアクセスする方法の一般的な考えを与える必要があります