All Questions
Tagged with magic-getter magento2
5 questions
1
vote
1
answer
409
views
Recevied Empty array after using getItemsByColumnValue() collection method
I'm trying to retrieve a row from a custom table named 'lmap_shipping_tablerate' using a specific value for a column postcode.
An empty array is returned when following line is used in my ...
1
vote
2
answers
646
views
Magic Method unsItemName()
I'm trying to use an unset magic method to delete a row from the table.
Following is the line of code from execute method of my CLI command.
$item->unsEquipmentName($input->getArgument(self::...
21
votes
2
answers
3k
views
Magento 2 - good practice to use/avoid magic getters?
Magic getters on Varien_Object (M1) and DataObject (M2) are common practice, but with Magento 2 it feels wrong to use it.
Good:
easy to read/write
Bad
It causes problems when using digits in keys (...
11
votes
2
answers
3k
views
Plugins for magic getters/setters
I'm trying to make the status of a review be approved instead of pending when the user posts it in the frontend in Magento 2.
And I took this approach. Create a before plugin, available only in the ...
8
votes
2
answers
2k
views
Magento 2: different way get field of a collection
I have this helper class in Magento 2:
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
protected $_countryFactory;
public function __construct(
\Magento\Directory\...