Monthly Archives: January 2018
- Posted: January 21, 2018Categories: Magento 2 DevelopmentRead more »
All PHP programmers are familiar with the superglobal variables such as $_GET, $_REQUEST, $_POST, but their direct use is not allowed according to Magento2 code standards. So don't use them in your Magento 2 projects, especially if you want to pass the code Technical Review on the Magento Marketplace.
So what methods should be used?
To get data from the query, use the following methods:
getParam($key, $default = null);
getPostParam($key, $default = null);
- Read more »
In Magento 2, one of the new properties is Magento 2 Virtual Type. What are they for?
Imagine that you already have a class A available:
public function __construct(
$this->arg1 = $arg1;
$this->arg2 = $arg2;
$this->arg3 = $arg3;
And you need to create a class B, which will be inherited from A. However, it must take another argument as $arg2. To do this, you will create a new PHP file for class B: