Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
ajax system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Dec 2012 at 16:55 UTC
Updated:
29 Jul 2014 at 21:39 UTC
Jump to comment: Most recent
Comments
Comment #1
fledev.com commentedHi,
your point is right, the $this-> and parent:: are equal in that situation. You should not forget that while willing to extend the AjaxResponse's class with setData method would bring confusion into the prepare method.
While using the parent:: syntax, it is clearly defined that the extended - parent class method should be used there. The $this-> syntax is taking the parent if the actual object doesn't have it or the current object method.
Here's a small experiment which I've used to clear this:
Please process your issue regarding the solution or close it.
Comment #2
damiankloip commentedI'm not really sure what your point is there :/
The fact that the parent class is used in that situation means you cannot use an overridden setData method. If it is not implemented on the class it will always inherit from the parent class. So $this->setData() will either get the current class or the inherited parent method. Isn't this just standard OOP?!
Comment #3
damiankloip commented.
Comment #4
dawehnerIt's the same during runtime, but it's not the same in terms of expression of code. We call another function here, and not "extend" the function here.
This feels ready to fly.
Comment #5
catchCommitted/pushed to 8.x, thanks!