您好,我正在使用symfony 1.4规则orm。我有三个表,例如course、calendar和course_offering。Course_offering表有两个指向课程和日程表的外键。这可以在管理生成器吗?多么?
发布于 2011-05-03 21:53:22
首先,你可以在你的模型中添加__toString()方法,返回你想要的值,而不是ids。
// lib/model/doctrine/JobeetJob.class.php
class JobeetJob extends BaseJobeetJob
{
public function __toString()
{
return sprintf('%s at %s (%s)', $this->getPosition(), $this->getCompany(), $this->getLocation());
}
}其次,如果您希望呈现特定布局,可以在admingen中使用partial作为列:
# apps/backend/modules/job/config/generator.yml
config:
form:
display:
Content: [category_id, type, company, logo, url, position, location, description, how_to_apply, is_public, email]
Admin: [_generated_token, is_activated, expires_at]
// apps/backend/modules/job/templates/_generated_token.php
<div class="sf_admin_form_row">
<label>Token</label>
<?php echo $form->getObject()->getToken() ?>
</div>https://stackoverflow.com/questions/5866733
复制相似问题