-
Couldn't load subscription status.
- Fork 6
Closed
Description
With our last change, we now have issues with actually existing methods:
Line Controller/Admin/SupplierProductsController.php
------ -----------------------------------------------------------------------
281 Method Cake\ORM\Table::findOrCreateBySku() invoked with 2 parameters,
1 required.
🪪 arguments.count
282 Access to an undefined property Cake\ORM\Query\SelectQuery::$id.
🪪 property.notFound
💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-und
efined-property
/**
* @param string $sku
* @param string $name
*
* @return \App\Model\Entity\Product
*/
public function findOrCreateBySku(string $sku, string $name): Product
{
$product = $this->find()
->where(['sku' => $sku])
->first();
if (!$product) {
$product = $this->newEntity([
'sku' => $sku,
'name' => $name,
]);
$product = $this->saveOrFail($product);
}
return $product;
}I think we need to check if the method actually exists and then skip our checks?
Metadata
Metadata
Assignees
Labels
No labels