I have two models, PtsPerStudy and SaeReport:
public class SaeReport extends Phalcon\Mvc\Model{
public function initialize(){
$this->belongsTo("ae_id","PtsPerStudy","id");
}
...
}
public class PtsPerStudy extends Phalcon\Mvc\Model{
public function initialize(){
$this->hasMany('id','SaeReport','ae_id');
}
...
}
Each SaeReport has one PtsPerStudy record and a PtsPerStudy record can have many SaeReport rows. Here is the code from the controller:
public function indexAction($id){
$numberPage = 1;
$identity=$this->auth->getIdentity();
$query = Criteria::fromInput($this->di,'SaeReport',$this->request->getPost());
$this->persistent->searchParams = $query->getParams();
$numberPage = $this->request->getQuery('page','int');
$parameters = array();
if($this->persistent->searchParams){
$parameters = $this->persistent->searchParams;
}else{
$parameters = "study_id = ".$id ;
}
$saereports = SaeReport::find($parameters);
$paginator = new Paginator(array("data"=>$saereports,"limit"=>10,"page"=>$numberPage));
$this->view->page = $paginator->getPaginate();
$mystudy = Studies::findFirstByPkStudy($id);
$this->view->mystudy=$mystudy;
}
And I see this error, once per row to be displayed, in /var/log/httpd/error_log:
[Tue Oct 21 11:37:05 2014] [error] [client 156.145.229.210] PHP Notice: Access to undefined property SaeReport::PtsPerStudy in /var/www/html/dsmc/app/cache/_var_www_html_dsmc_app_views_saereport_index.volt.php on line 23, referer: <url>
Is this something that I am doing wrong or is there a bug in the volt template engine? I would think that it should be accessing it like SaeReport->PtsPerStudy not SaeReport::PtsPerStudy, no?