Recevied Empty array after using getItemsByColumnValue() collection method
-
25-02-2021 - |
Frage
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 ResourceModel php file.
use MyVendor\MyModule\Model\Carrier\ResourceModel\Shipping\CollectionFactory;
$postcode_rate_row = $this->collectionFactory->create()->getItemsByColumnValue('postcode', $value);
$this->logger->debug('Rates received: '.var_dump($postcode_rate_row));
Below is the directory structure
Am I using the collection factory in correct manner.
I have also created a helper file to get the desired row and used the same above code to return the array back to the calling method in ResourceModel php file but again empty array is received.
Lösung
Kindly check other functions
use MyVendor\MyModule\Model\Carrier\ResourceModel\Shipping\CollectionFactory;
$postcode_rate_row = $this->collectionFactory->create();
print_r(get_class_methods($postcode_rate_row));?>
It return list of methods, choose the correct one.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange