Like consider i have a container instance create like category
i want to use this instance inside product custom class
Like consider i have a container instance create like category
i want to use this instance inside product custom class
Not sure I understand you, have you got some example code?
Consider i have an instance of a class in container how can i use it in my custom class.
I believe you need to do it like this:
$container['myclass'] = function ($container) {
return new App\Model\myClass($container->get('your_instance'));
};
Then in your class you should have this:
protected $your_instance;
public function __construct($your_instance) {
$this->your_instance = $your_instance;
}
Thank you very much.