Skip to main content

Questions tagged [oop]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
505 views

Magento 2 how to overwrite a trait function

How do you overwrite a trait function from vendor. Things i did try in the di.xml <preference for="\Vendor\Module\Traits\Model\ChangeMe" type="\Company\Module\Traits\...
Johan's user avatar
  • 11
0 votes
3 answers
784 views

What mean this function in magento 2

I saw a function declared like this below. <?php public function getFirstName():string { return $this->firstName(); } why this :string is used and when I should use this.
Ramesh KR's user avatar
  • 886
1 vote
2 answers
1k views

How to find class by function name in PHP class?

For example I have a class A which extends class B and B extends C and so on. Now I can get all the function which is accessible in class A by php function getClassMethods($this); But if I found a ...
26vivek's user avatar
  • 467
1 vote
1 answer
366 views

Difference between class constant and class static variable with array as a value in php7?

Example: class Test { const URLS = [ 'http://example.com/', 'http://example1.com/' ]; public static $urls = [ 'http://example.com/', ...
Milind Singh's user avatar
  • 1,594
0 votes
1 answer
394 views

How can I use Namespaces and USE function in magento 1.9?

How can I use Namespaces and USE function in magento 1.9 ? I dont want to use require or include function just set one namespaces and use this in my controller like laravel or magento 2. Is it ...
Yuvraj Singh Shekhawat's user avatar
2 votes
1 answer
1k views

What does getLoadedProductCollection()->clear() do?

I am new to magento, but have some experience in Object Oriented Programming (OOP), so I understand the concept that you are building a query in an object through multiple commands - which can ...
Oliver Williams's user avatar
3 votes
2 answers
914 views

Magento 2: Clear Direction on Controller Result Factories

In a controller's execute method, has there been any clear guidance from the Magento core team if client developers should Be using the individual PageFactory, JsonFactory, RawFactory, etc objects ...
Alana Storm's user avatar
  • 44.4k