0

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

enter image description here enter image description here

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.