/**
* Returns the associated resource, accounting for bad references.
* @return Resource|null
*/
public function getResource()
{
if (is_null($this->_resource_is_valid))
{
try
{
// We need to call a method that triggers a lazy load
if ($this->resource && $this->resource->getID())
{
$this->_resource_is_valid = true;
}
}
catch (\Doctrine\ORM\EntityNotFoundException $enf)
{
$this->_resource_is_valid = false;
// consider creating a new resource object.
}
}
if ($this->_resource_is_valid)
{
return $this->resource;
}
return null;
}
只是一个查询集,它显示在html_as_template
中,我正在通过Ajax刷新(包含来自数据库的更新数据)。
两个问题:
article_cards.html
也应该起作用吗? render_to_string