I have overwrited the bundle class usig di.xml
preference for="Magento\Bundle\Block\Catalog\Product\View\Type\Bundle"type="Bachus\BundleContextPros\Block\Catalog\Product\View\Type\Bundle" />
in my custom module. Now I want to write a method in this class which will create my model (Bunleset) wchih I created In my cusotm module. I want to get some data form my custom table here.
my method in Bachus\BundleContextPros\Block\Catalog\Product\View\Type\Bundle.php
class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
{
...
public function generateJsContext(){
$model = new \Bachus\BundleContextPros\Model\Bundleset();
foreach($this->getOptions() as $option){
$title = $option->getTitle();
}
return $title;
}
but I get error like that:
Uncaught TypeError: Argument 1 passed to Magento\Framework\Model\AbstractModel::__construct() must be an instance of Magento\Framework\Model\Context, none given, called in
I know my model bundleset class, reasourcecollection etc. are ok beacuse I have followed Alanstorm CRUD tutoral And I can fetch the data in example blocks. But I need this data in Bundle class method to then display it on option.phtml. Please Help