Add a "boolean" column to Symfony's generated admin
I have a blog made with symfony 1.4. In the generated admin, I've added the column "has tags", by adding the following to Content.class.php
:
public function getHasTags()
{
$count = Doctrine_Core::getTable('Tagging')
->createQuery('c')
->where('c.taggable_model = "Content"')
->andwhere('c.taggable_id = ?', $this->getId())
->count();
if ($count > 0)
return true;
else
return false;
}
This works, but the column only shows "1" for true and nothing for false. Can I set this new column as boolean, so that symfony will show the picture of a cross or a check mark ?
in your generator.yml
fields:
yourFieldName:
label: Has link
type: Boolean
精彩评论