Brent W
Well-known member
I am rewriting an old add-on as well as adding a few new features to it as a project to get more familiar with xenForo 2.2 code structure, classes and such. I have three different lines of code that seem to all do the exact same thing and work and I am confused on why they all three work and which one I should be using.
The three pieces of code are:
All three work and all three return the data I am expecting.
1) Why do all three work
2) Why are there three different ways to do the same thing
3) Which should I be using?
The three examples are used inside a method structured similar to above.
The three pieces of code are:
PHP:
$this->app->find()
PHP:
$this->app()->find()
PHP:
$this->app->em()->find()
All three work and all three return the data I am expecting.
1) Why do all three work
2) Why are there three different ways to do the same thing
3) Which should I be using?
PHP:
use XF\Widget\AbstractWidget;
class Test extends AbstractWidget {
protected function find() {
}
}
The three examples are used inside a method structured similar to above.
Last edited: