Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use Isotope product types that are registered services #2396

Open
richardhj opened this issue Jan 7, 2023 · 1 comment
Open

Allow to use Isotope product types that are registered services #2396

richardhj opened this issue Jan 7, 2023 · 1 comment

Comments

@richardhj
Copy link
Member

Can we use System::importStatic($strClass) here to initialize the product (line 167), so that we can create instances of an Isotope product from services registered in the container?

$strClass = Product::getClassForModelType($this->type);
if ($strClass == '' || !class_exists($strClass)) {
System::log('Error creating product object of type "' . $this->type . '"', __METHOD__, TL_ERROR);
return null;
}
try {
$this->objProduct = $strClass::findByPk($this->product_id);

The background of my question is that my product class has to be initialized differently.

@aschempp
Copy link
Member

these are model classes, I don't think we can use services for these? Do you mean the call to the static method of our model/repository should be to a service?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants