/** * Creates \CC15\MQ\VO\Import object from object * * @param object $input * @param string $group * @param Import $object * * @throws \InvalidArgumentException * * @return Import */ public static function fromObject($input, $group = NULL, $object = NULL) { $input = (array) $input; if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\MQ\\VO\\Import' . '.'); } else { $id = self::$groups[$group]; } if ($object === null) { $object = new Import(); } elseif (!$object instanceof Import) { throw new \InvalidArgumentException('You have to pass object of class CC15\\MQ\\VO\\Import.'); } if (($id & 1) > 0 && isset($input['eshop'])) { $object->eshop = EshopMeta::fromObject($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::fromObject($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['feed'])) { $object->feed = FeedMeta::fromObject($input['feed'], $group, isset($object->feed) ? $object->feed : null); } elseif (($id & 1) > 0 && array_key_exists('feed', $input) && $input['feed'] === NULL) { $object->feed = NULL; } if (($id & 2) > 0 && isset($input['feed'])) { $object->feed = FeedMeta::fromObject($input['feed'], $group, isset($object->feed) ? $object->feed : null); } elseif (($id & 2) > 0 && array_key_exists('feed', $input) && $input['feed'] === NULL) { $object->feed = NULL; } if (($id & 1) > 0 && isset($input['tmpFileName'])) { $object->tmpFileName = $input['tmpFileName']; } elseif (($id & 1) > 0 && array_key_exists('tmpFileName', $input) && $input['tmpFileName'] === NULL) { $object->tmpFileName = NULL; } if (($id & 2) > 0 && isset($input['tmpFileName'])) { $object->tmpFileName = $input['tmpFileName']; } elseif (($id & 2) > 0 && array_key_exists('tmpFileName', $input) && $input['tmpFileName'] === NULL) { $object->tmpFileName = NULL; } return $object; }
/** * Creates \CC15\Entity\Eshop object from object * * @param object $input * @param string $group * @param Eshop $object * * @throws \InvalidArgumentException * * @return Eshop */ public static function fromObject($input, $group = NULL, $object = NULL) { $input = (array) $input; if (!isset(self::$groups[$group])) { throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\Entity\\Eshop' . '.'); } else { $id = self::$groups[$group]; } if ($object === null) { $object = new Eshop(); } elseif (!$object instanceof Eshop) { throw new \InvalidArgumentException('You have to pass object of class CC15\\Entity\\Eshop.'); } 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['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['slug'])) { $object->slug = $input['slug']; } elseif (($id & 1) > 0 && array_key_exists('slug', $input) && $input['slug'] === NULL) { $object->slug = NULL; } if (($id & 2) > 0 && isset($input['slug'])) { $object->slug = $input['slug']; } elseif (($id & 2) > 0 && array_key_exists('slug', $input) && $input['slug'] === NULL) { $object->slug = 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['feeds'])) { if (!(isset($object->feeds) && is_array($object->feeds))) { $object->feeds = array(); } foreach ((array) $input['feeds'] as $k0 => $v0) { $object->feeds[$k0] = FeedMeta::fromObject($v0, $group, isset($object->feeds[$k0]) ? $object->feeds[$k0] : null); } } elseif (($id & 1) > 0 && array_key_exists('feeds', $input) && $input['feeds'] === NULL) { $object->feeds = NULL; } if (($id & 2) > 0 && isset($input['feeds'])) { if (!(isset($object->feeds) && is_array($object->feeds))) { $object->feeds = array(); } foreach ((array) $input['feeds'] as $k0 => $v0) { $object->feeds[$k0] = FeedMeta::fromObject($v0, $group, isset($object->feeds[$k0]) ? $object->feeds[$k0] : null); } } elseif (($id & 2) > 0 && array_key_exists('feeds', $input) && $input['feeds'] === NULL) { $object->feeds = NULL; } return $object; }