/** * Creates \CC15\Entity\Product object from array * * @param array $input * @param string $group * @param Product $object * * @throws \InvalidArgumentException * * @return Product */ public static function fromArray($input, $group = NULL, $object = NULL) { if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\Entity\\Product' . '.'); } else { $id = self::$groups[$group]; } if ($object === null) { $object = new Product(); } elseif (!$object instanceof Product) { throw new \InvalidArgumentException('You have to pass object of class CC15\\Entity\\Product.'); } if (($id & 1) > 0 && isset($input['_id'])) { $object->id = $input['_id']; } elseif (($id & 1) > 0 && array_key_exists('_id', $input) && $input['_id'] === NULL) { $object->id = NULL; } if (($id & 2) > 0 && isset($input['id'])) { $object->id = new \MongoId($input['id']); } elseif (($id & 2) > 0 && array_key_exists('id', $input) && $input['id'] === NULL) { $object->id = NULL; } if (($id & 1) > 0 && isset($input['v'])) { $object->v = $input['v']; } elseif (($id & 1) > 0 && array_key_exists('v', $input) && $input['v'] === NULL) { $object->v = NULL; } if (($id & 2) > 0 && isset($input['v'])) { $object->v = $input['v']; } elseif (($id & 2) > 0 && array_key_exists('v', $input) && $input['v'] === NULL) { $object->v = NULL; } if (($id & 1) > 0 && isset($input['eshopId'])) { $object->eshopId = $input['eshopId']; } elseif (($id & 1) > 0 && array_key_exists('eshopId', $input) && $input['eshopId'] === NULL) { $object->eshopId = NULL; } if (($id & 2) > 0 && isset($input['eshopId'])) { $object->eshopId = new \MongoId($input['eshopId']); } elseif (($id & 2) > 0 && array_key_exists('eshopId', $input) && $input['eshopId'] === NULL) { $object->eshopId = NULL; } if (($id & 1) > 0 && isset($input['eshop'])) { $object->eshop = EshopMeta::fromArray($input['eshop'], $group, isset($object->eshop) ? $object->eshop : null); } elseif (($id & 1) > 0 && array_key_exists('eshop', $input) && $input['eshop'] === NULL) { $object->eshop = NULL; } if (($id & 2) > 0 && isset($input['eshop'])) { $object->eshop = EshopMeta::fromArray($input['eshop'], $group, isset($object->eshop) ? $object->eshop : null); } elseif (($id & 2) > 0 && array_key_exists('eshop', $input) && $input['eshop'] === NULL) { $object->eshop = NULL; } if (($id & 1) > 0 && isset($input['itemGroupId'])) { $object->itemGroupId = $input['itemGroupId']; } elseif (($id & 1) > 0 && array_key_exists('itemGroupId', $input) && $input['itemGroupId'] === NULL) { $object->itemGroupId = NULL; } if (($id & 2) > 0 && isset($input['itemGroupId'])) { $object->itemGroupId = $input['itemGroupId']; } elseif (($id & 2) > 0 && array_key_exists('itemGroupId', $input) && $input['itemGroupId'] === NULL) { $object->itemGroupId = NULL; } if (($id & 1) > 0 && isset($input['itemId'])) { $object->itemId = $input['itemId']; } elseif (($id & 1) > 0 && array_key_exists('itemId', $input) && $input['itemId'] === NULL) { $object->itemId = NULL; } if (($id & 2) > 0 && isset($input['itemId'])) { $object->itemId = $input['itemId']; } elseif (($id & 2) > 0 && array_key_exists('itemId', $input) && $input['itemId'] === NULL) { $object->itemId = NULL; } if (($id & 1) > 0 && isset($input['name'])) { $object->name = $input['name']; } elseif (($id & 1) > 0 && array_key_exists('name', $input) && $input['name'] === NULL) { $object->name = NULL; } if (($id & 2) > 0 && isset($input['name'])) { $object->name = $input['name']; } elseif (($id & 2) > 0 && array_key_exists('name', $input) && $input['name'] === NULL) { $object->name = NULL; } if (($id & 1) > 0 && isset($input['longName'])) { $object->longName = $input['longName']; } elseif (($id & 1) > 0 && array_key_exists('longName', $input) && $input['longName'] === NULL) { $object->longName = NULL; } if (($id & 2) > 0 && isset($input['longName'])) { $object->longName = $input['longName']; } elseif (($id & 2) > 0 && array_key_exists('longName', $input) && $input['longName'] === NULL) { $object->longName = NULL; } if (($id & 1) > 0 && isset($input['description'])) { $object->description = $input['description']; } elseif (($id & 1) > 0 && array_key_exists('description', $input) && $input['description'] === NULL) { $object->description = NULL; } if (($id & 2) > 0 && isset($input['description'])) { $object->description = $input['description']; } elseif (($id & 2) > 0 && array_key_exists('description', $input) && $input['description'] === NULL) { $object->description = NULL; } if (($id & 1) > 0 && isset($input['url'])) { $object->url = $input['url']; } elseif (($id & 1) > 0 && array_key_exists('url', $input) && $input['url'] === NULL) { $object->url = NULL; } if (($id & 2) > 0 && isset($input['url'])) { $object->url = $input['url']; } elseif (($id & 2) > 0 && array_key_exists('url', $input) && $input['url'] === NULL) { $object->url = NULL; } if (($id & 1) > 0 && isset($input['price'])) { $object->price = $input['price']; } elseif (($id & 1) > 0 && array_key_exists('price', $input) && $input['price'] === NULL) { $object->price = NULL; } if (($id & 2) > 0 && isset($input['price'])) { $object->price = $input['price']; } elseif (($id & 2) > 0 && array_key_exists('price', $input) && $input['price'] === NULL) { $object->price = NULL; } if (($id & 1) > 0 && isset($input['deliveryDate'])) { $object->deliveryDate = $input['deliveryDate']; } elseif (($id & 1) > 0 && array_key_exists('deliveryDate', $input) && $input['deliveryDate'] === NULL) { $object->deliveryDate = NULL; } if (($id & 2) > 0 && isset($input['deliveryDate'])) { $object->deliveryDate = $input['deliveryDate']; } elseif (($id & 2) > 0 && array_key_exists('deliveryDate', $input) && $input['deliveryDate'] === NULL) { $object->deliveryDate = NULL; } if (($id & 1) > 0 && isset($input['images'])) { if (!(isset($object->images) && is_array($object->images))) { $object->images = array(); } foreach ((array) $input['images'] as $k0 => $v0) { $object->images[$k0] = ImageMeta::fromArray($v0, $group, isset($object->images[$k0]) ? $object->images[$k0] : null); } } elseif (($id & 1) > 0 && array_key_exists('images', $input) && $input['images'] === NULL) { $object->images = NULL; } if (($id & 2) > 0 && isset($input['images'])) { if (!(isset($object->images) && is_array($object->images))) { $object->images = array(); } foreach ((array) $input['images'] as $k0 => $v0) { $object->images[$k0] = ImageMeta::fromArray($v0, $group, isset($object->images[$k0]) ? $object->images[$k0] : null); } } elseif (($id & 2) > 0 && array_key_exists('images', $input) && $input['images'] === NULL) { $object->images = NULL; } if (($id & 1) > 0 && isset($input['ean'])) { $object->ean = $input['ean']; } elseif (($id & 1) > 0 && array_key_exists('ean', $input) && $input['ean'] === NULL) { $object->ean = NULL; } if (($id & 2) > 0 && isset($input['ean'])) { $object->ean = $input['ean']; } elseif (($id & 2) > 0 && array_key_exists('ean', $input) && $input['ean'] === NULL) { $object->ean = NULL; } if (($id & 1) > 0 && isset($input['isbn'])) { $object->isbn = $input['isbn']; } elseif (($id & 1) > 0 && array_key_exists('isbn', $input) && $input['isbn'] === NULL) { $object->isbn = NULL; } if (($id & 2) > 0 && isset($input['isbn'])) { $object->isbn = $input['isbn']; } elseif (($id & 2) > 0 && array_key_exists('isbn', $input) && $input['isbn'] === NULL) { $object->isbn = NULL; } if (($id & 1) > 0 && isset($input['productno'])) { $object->productno = $input['productno']; } elseif (($id & 1) > 0 && array_key_exists('productno', $input) && $input['productno'] === NULL) { $object->productno = NULL; } if (($id & 2) > 0 && isset($input['productno'])) { $object->productno = $input['productno']; } elseif (($id & 2) > 0 && array_key_exists('productno', $input) && $input['productno'] === NULL) { $object->productno = NULL; } if (($id & 1) > 0 && isset($input['manufacturer'])) { $object->manufacturer = $input['manufacturer']; } elseif (($id & 1) > 0 && array_key_exists('manufacturer', $input) && $input['manufacturer'] === NULL) { $object->manufacturer = NULL; } if (($id & 2) > 0 && isset($input['manufacturer'])) { $object->manufacturer = $input['manufacturer']; } elseif (($id & 2) > 0 && array_key_exists('manufacturer', $input) && $input['manufacturer'] === NULL) { $object->manufacturer = NULL; } if (($id & 1) > 0 && isset($input['brand'])) { $object->brand = $input['brand']; } elseif (($id & 1) > 0 && array_key_exists('brand', $input) && $input['brand'] === NULL) { $object->brand = NULL; } if (($id & 2) > 0 && isset($input['brand'])) { $object->brand = $input['brand']; } elseif (($id & 2) > 0 && array_key_exists('brand', $input) && $input['brand'] === NULL) { $object->brand = NULL; } if (($id & 1) > 0 && isset($input['categoryTexts'])) { if (!(isset($object->categoryTexts) && is_array($object->categoryTexts))) { $object->categoryTexts = array(); } foreach ((array) $input['categoryTexts'] as $k0 => $v0) { $object->categoryTexts[$k0] = $v0; } } elseif (($id & 1) > 0 && array_key_exists('categoryTexts', $input) && $input['categoryTexts'] === NULL) { $object->categoryTexts = NULL; } if (($id & 2) > 0 && isset($input['categoryTexts'])) { if (!(isset($object->categoryTexts) && is_array($object->categoryTexts))) { $object->categoryTexts = array(); } foreach ((array) $input['categoryTexts'] as $k0 => $v0) { $object->categoryTexts[$k0] = $v0; } } elseif (($id & 2) > 0 && array_key_exists('categoryTexts', $input) && $input['categoryTexts'] === NULL) { $object->categoryTexts = NULL; } if (($id & 1) > 0 && isset($input['categoryIds'])) { if (!(isset($object->categoryIds) && is_array($object->categoryIds))) { $object->categoryIds = array(); } foreach ((array) $input['categoryIds'] as $k0 => $v0) { $object->categoryIds[$k0] = $v0; } } elseif (($id & 1) > 0 && array_key_exists('categoryIds', $input) && $input['categoryIds'] === NULL) { $object->categoryIds = NULL; } if (($id & 2) > 0 && isset($input['categoryIds'])) { if (!(isset($object->categoryIds) && is_array($object->categoryIds))) { $object->categoryIds = array(); } foreach ((array) $input['categoryIds'] as $k0 => $v0) { $object->categoryIds[$k0] = new \MongoId($v0); } } elseif (($id & 2) > 0 && array_key_exists('categoryIds', $input) && $input['categoryIds'] === NULL) { $object->categoryIds = NULL; } if (($id & 1) > 0 && isset($input['categories'])) { if (!(isset($object->categories) && is_array($object->categories))) { $object->categories = array(); } foreach ((array) $input['categories'] as $k0 => $v0) { $object->categories[$k0] = CategoryMeta::fromArray($v0, $group, isset($object->categories[$k0]) ? $object->categories[$k0] : null); } } elseif (($id & 1) > 0 && array_key_exists('categories', $input) && $input['categories'] === NULL) { $object->categories = NULL; } if (($id & 2) > 0 && isset($input['categories'])) { if (!(isset($object->categories) && is_array($object->categories))) { $object->categories = array(); } foreach ((array) $input['categories'] as $k0 => $v0) { $object->categories[$k0] = CategoryMeta::fromArray($v0, $group, isset($object->categories[$k0]) ? $object->categories[$k0] : null); } } elseif (($id & 2) > 0 && array_key_exists('categories', $input) && $input['categories'] === NULL) { $object->categories = NULL; } if (($id & 1) > 0 && isset($input['itemType'])) { $object->itemType = $input['itemType']; } elseif (($id & 1) > 0 && array_key_exists('itemType', $input) && $input['itemType'] === NULL) { $object->itemType = NULL; } if (($id & 2) > 0 && isset($input['itemType'])) { $object->itemType = $input['itemType']; } elseif (($id & 2) > 0 && array_key_exists('itemType', $input) && $input['itemType'] === NULL) { $object->itemType = NULL; } if (($id & 1) > 0 && isset($input['extraMessages'])) { if (!(isset($object->extraMessages) && is_array($object->extraMessages))) { $object->extraMessages = array(); } foreach ((array) $input['extraMessages'] as $k0 => $v0) { $object->extraMessages[$k0] = $v0; } } elseif (($id & 1) > 0 && array_key_exists('extraMessages', $input) && $input['extraMessages'] === NULL) { $object->extraMessages = NULL; } if (($id & 2) > 0 && isset($input['extraMessages'])) { if (!(isset($object->extraMessages) && is_array($object->extraMessages))) { $object->extraMessages = array(); } foreach ((array) $input['extraMessages'] as $k0 => $v0) { $object->extraMessages[$k0] = $v0; } } elseif (($id & 2) > 0 && array_key_exists('extraMessages', $input) && $input['extraMessages'] === NULL) { $object->extraMessages = NULL; } return $object; }
/** * Creates \CC15\MQ\VO\Change object from array * * @param array $input * @param string $group * @param Change $object * * @throws \InvalidArgumentException * * @return Change */ public static function fromArray($input, $group = NULL, $object = NULL) { if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\MQ\\VO\\Change' . '.'); } else { $id = self::$groups[$group]; } if ($object === null) { $object = new Change(); } elseif (!$object instanceof Change) { throw new \InvalidArgumentException('You have to pass object of class CC15\\MQ\\VO\\Change.'); } if (($id & 1) > 0 && isset($input['product'])) { $object->product = ProductMeta::fromArray($input['product'], $group, isset($object->product) ? $object->product : null); } elseif (($id & 1) > 0 && array_key_exists('product', $input) && $input['product'] === NULL) { $object->product = NULL; } if (($id & 2) > 0 && isset($input['product'])) { $object->product = ProductMeta::fromArray($input['product'], $group, isset($object->product) ? $object->product : null); } elseif (($id & 2) > 0 && array_key_exists('product', $input) && $input['product'] === NULL) { $object->product = NULL; } if (($id & 1) > 0 && isset($input['category'])) { $object->category = CategoryMeta::fromArray($input['category'], $group, isset($object->category) ? $object->category : null); } elseif (($id & 1) > 0 && array_key_exists('category', $input) && $input['category'] === NULL) { $object->category = NULL; } if (($id & 2) > 0 && isset($input['category'])) { $object->category = CategoryMeta::fromArray($input['category'], $group, isset($object->category) ? $object->category : null); } elseif (($id & 2) > 0 && array_key_exists('category', $input) && $input['category'] === NULL) { $object->category = NULL; } return $object; }