/** * @param array $data * @return EnumValue */ public static function createFromArray(array $data) { $instance = new self(); if (isset($data['id'])) { $instance->setId($data['id']); } if (isset($data['label'])) { $instance->setLabel($data['label']); } if (isset($data['is_default'])) { $instance->setIsDefault($data['is_default']); } if (isset($data['priority'])) { $instance->setPriority($data['priority']); } return $instance; }
/** * @param ShopEntity $shop * @return Shop */ public static function createFromShopEntity(ShopEntity $shop) { $struct = new self(); $struct->setId($shop->getId()); $struct->setParentId($shop->getMain() ? $shop->getMain()->getId() : $shop->getId()); $struct->setIsDefault($shop->getDefault()); $struct->setName($shop->getName()); $struct->setHost($shop->getHost()); $struct->setPath($shop->getBasePath()); $struct->setUrl($shop->getBaseUrl()); $struct->setSecure($shop->getSecure()); $struct->setSecureHost($shop->getSecureHost()); $struct->setSecurePath($shop->getSecureBasePath()); if ($shop->getCategory()) { $struct->setCategory(Category::createFromCategoryEntity($shop->getCategory())); } if ($shop->getFallback()) { $struct->setFallbackId($shop->getFallback()->getId()); } return $struct; }