Hello,
I created a new page MyNewPage by extending UserDefinedForm and created the controller (extending UserDefinedForm_Controller) too. The page itself contains getter-methods to access the db-fields. A new site in CMS was created.
By sending an AJAX-Request, handled in the controller, I want to access this getter-method by
$this->data()->myGetter();
I got an error message "Object->__call(): the method 'myGetter' does not exist on 'Page'. I am wondering about the resulting type of $this->data() beeing type Page. I expected the page type MyNewPage.
By investigating the situation, I found a code snippet in the constructor of ContentController. At this point (line 41 in v2.4.1), the class-variable $dataRecord is set = new Page(); if the dataRecord was not given as parameter. I don´t understand this relation, why $dataRecord is not set to the correct model-instance of MyNewPage.
I think, the problem is related to the AJAX-url, with which the determination of a concrete instance is not possible. Is the only solution to determine the dataObject by myself in handling the AJAX-Request?
Best regards,
chrclaus