[Solved] Overriding model file of third party extension magento2.3.2: Type Error occurred when creating object

mockingbird Asks: Overriding model file of third party extension magento2.3.2: Type Error occurred when creating object
I am using amasty store locator extension. and I am customizing one of the model files of the extension.The file which i want to override is located inside Amasty/Storelocator/model/location.php. But When I am trying to override the file it is giving me this type of error. I have tried bin/magento setup:di:compile command. Tried deleting generated folder but still, this error is coming. Thank you in advance.

1 exception(s): Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: VendorMapModelLocation

Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: VendorMapModelLocation

#1 MagentoFrameworkObjectManagerFactoryCompiled->create(‘VendorMapModel…’) called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150] #2 MagentoFrameworkObjectManagerFactoryCompiled->get(‘VendorMapModel…’) called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79] #3 MagentoFrameworkObjectManagerFactoryCompiled->create(‘AmastyStoreloca…’, array(‘data’ => array())) called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56] #4 MagentoFrameworkObjectManagerObjectManager->create(‘AmastyStoreloca…’, array(‘data’ => array())) called at [vendor/magento/framework/View/Element/BlockFactory.php:46] #5 MagentoFrameworkViewElementBlockFactory->createBlock(‘AmastyStoreloca…’, array(‘data’ => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:268] #6 MagentoFrameworkViewLayoutGeneratorBlock->getBlockInstance(‘AmastyStoreloca…’, array(‘data’ => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:248] #7 MagentoFrameworkViewLayoutGeneratorBlock->createBlock(‘AmastyStoreloca…’, ‘amasty.locator.c…’, array(‘data’ => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:226] #8 MagentoFrameworkViewLayoutGeneratorBlock->generateBlock(&MagentoFrameworkViewLayoutScheduledStructure#000000001b3442af000000003a4d0e5f#, —————————————————————– **app/code/Vendor/Map/etc/di.xml** —————————————————————— **app/code/Vendor/Map/Model/Location.php** namespace VendorMapModel; use MagentoFrameworkEscaper; class Location extends AmastyStorelocatorModelLocation { private $escaper; private $configProvider; protected $storeManager; protected $serializer; protected $productCollectionFactory; public function __construct( Escaper $escaper, ConfigProvider $configProvider, MagentoFrameworkModelContext $context, MagentoFrameworkRegistry $registry, MagentoFrameworkDataFormFactory $formFactory, MagentoStoreModelStoreManagerInterface $storeManager, MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory, array $data = []) { $this->storeManager = $storeManager; $this->escaper = $escaper; $this->configProvider = $configProvider; $this->productCollectionFactory = $productCollectionFactory; parent::__construct( $context, $registry, $formFactory, null); } Public Custom Function }

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.