/** * @param ICompany $company * @return bool * @throws PolicyException */ public function canAdd(ICompany $company) { $current = $this->repository->countByCompany($company->getIdentifier()); $allowed = $company->getAllowedMarketplaceTypeInstances($this->marketplace_type_repository->getByType(IAppliance::MarketPlaceType)); if ($current >= $allowed) { throw new PolicyException('ApplianceAddPolicy', sprintf('You reach the max. amount of %s (%s) per Company', "Appliances", $allowed)); } return true; }
public function getUsePricingSchema() { $type_id = intval($this->request->getVar('type_id')); if ($type_id > 0) { $product_type = $this->marketplace_repository->getById($type_id); if ($product_type->getName() == IPublicCloudService::MarketPlaceType) { return true; } } return $this->getCurrentPublicCloud(); }