productPriceResolver = $productPriceResolver; $this->orderProductPriceResolver = $orderProductPriceResolver; $this->orderShopPriceResolver = $orderShopPriceResolver; } public function __call($name, $arguments) { if (strpos($name, 'apply') === false) { $entity = $arguments[0]; $service = ''; if ($entity instanceof ProductPropertyInterface) { $service = 'productPriceResolver'; } if ($entity instanceof OrderProductInterface) { $service = 'orderProductPriceResolver'; } if ($entity instanceof OrderShopInterface || is_iterable($entity) || is_array($entity)) { $service = 'orderShopPriceResolver'; } if (strlen($service) && $entity && method_exists($this->$service, $name)) { if (isset($arguments[1]) && isset($arguments[2]) && isset($arguments[3])) { return $this->$service->$name($entity, $arguments[1], $arguments[2], $arguments[3]); } elseif (isset($arguments[1]) && isset($arguments[2])) { return $this->$service->$name($entity, $arguments[1], $arguments[2]); } elseif (isset($arguments[1])) { return $this->$service->$name($entity, $arguments[1]); } else { return $this->$service->$name($entity); } } else { if (!strlen($service)) { throw new \ErrorException("PriceResolver : le type d'entité n'est pas géré"); } else { if (!method_exists($this->$service, $name)) { throw new \ErrorException( "PriceResolver : la méthode " . $name . " du service " . $service . " n'existe pas." ); } } } return false; } } }