protected function execute(InputInterface $input, OutputInterface $output)
 {
     $categoryCol = $this->mongo->createCollection(CategoryMeta::SHORT_NAME);
     var_dump($categoryCol->ensureIndex([CategoryMeta::ESHOP_ID => 1, CategoryMeta::HASH => 1], ["unique" => true]));
     $productCol = $this->mongo->createCollection(ProductMeta::SHORT_NAME);
     var_dump($productCol->ensureIndex([ProductMeta::ESHOP_ID => 1, ProductMeta::ITEM_GROUP_ID => 1, ProductMeta::ITEM_ID => 1], ["unique" => true]));
     var_dump($productCol->ensureIndex(["_id" => 1, ProductMeta::V => 1], ["unique" => true]));
     $eshopCol = $this->mongo->createCollection(EshopMeta::SHORT_NAME);
     var_dump($eshopCol->ensureIndex([EshopMeta::SLUG => 1]), ["unique" => true]);
     $f = fopen($input->getArgument("csv"), "r");
     while (list($slug, $url, $feedUrl) = fgetcsv($f)) {
         $eshop = new Eshop();
         $eshop->setName($slug)->setSlug($slug)->setUrl($url)->setFeeds([(new Feed())->setId(new \MongoId())->setUrl($feedUrl)]);
         $eshopDoc = $this->eshopRepository->findAndModify([EshopMeta::SLUG => $slug], EshopMeta::toArray($eshop), ["_id"], ["upsert" => true, "new" => true]);
         var_dump($eshopDoc);
     }
 }
 /**
  * Serializes \CC15\MQ\VO\Import to object
  *
  * @param Import $object
  * @param string $group
  *
  * @throws \InvalidArgumentException
  *
  * @return object
  */
 public static function toObject($object, $group = NULL)
 {
     if ($object === null) {
         return null;
     }
     if (!isset(self::$groups[$group])) {
         throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\MQ\\VO\\Import' . '.');
     } else {
         $id = self::$groups[$group];
     }
     if (!$object instanceof Import) {
         throw new \InvalidArgumentException('You have to pass object of class CC15\\MQ\\VO\\Import.');
     }
     $output = array();
     if (($id & 1) > 0) {
         $output['eshop'] = EshopMeta::toObject($object->eshop, $group);
     }
     if (($id & 2) > 0 && isset($object->eshop)) {
         $output['eshop'] = EshopMeta::toObject($object->eshop, $group);
     }
     if (($id & 1) > 0) {
         $output['feed'] = FeedMeta::toObject($object->feed, $group);
     }
     if (($id & 2) > 0 && isset($object->feed)) {
         $output['feed'] = FeedMeta::toObject($object->feed, $group);
     }
     if (($id & 1) > 0) {
         $output['tmpFileName'] = $object->tmpFileName;
     }
     if (($id & 2) > 0 && isset($object->tmpFileName)) {
         $output['tmpFileName'] = $object->tmpFileName;
     }
     return (object) $output;
 }
 /**
  * Serializes \CC15\Entity\Product to object
  *
  * @param Product $object
  * @param string $group
  *
  * @throws \InvalidArgumentException
  *
  * @return object
  */
 public static function toObject($object, $group = NULL)
 {
     if ($object === null) {
         return null;
     }
     if (!isset(self::$groups[$group])) {
         throw new \InvalidArgumentException('Group \'' . $group . '\' not supported for ' . 'CC15\\Entity\\Product' . '.');
     } else {
         $id = self::$groups[$group];
     }
     if (!$object instanceof Product) {
         throw new \InvalidArgumentException('You have to pass object of class CC15\\Entity\\Product.');
     }
     $output = array();
     if (($id & 1) > 0 && isset($object->id)) {
         $output['_id'] = $object->id;
     }
     if (($id & 2) > 0 && isset($object->id)) {
         $output['id'] = (string) $object->id;
     }
     if (($id & 1) > 0) {
         $output['v'] = $object->v;
     }
     if (($id & 2) > 0 && isset($object->v)) {
         $output['v'] = $object->v;
     }
     if (($id & 1) > 0) {
         $output['eshopId'] = $object->eshopId;
     }
     if (($id & 2) > 0 && isset($object->eshopId)) {
         $output['eshopId'] = (string) $object->eshopId;
     }
     if (($id & 1) > 0) {
         $output['eshop'] = EshopMeta::toObject($object->eshop, $group);
     }
     if (($id & 2) > 0 && isset($object->eshop)) {
         $output['eshop'] = EshopMeta::toObject($object->eshop, $group);
     }
     if (($id & 1) > 0) {
         $output['itemGroupId'] = $object->itemGroupId;
     }
     if (($id & 2) > 0 && isset($object->itemGroupId)) {
         $output['itemGroupId'] = $object->itemGroupId;
     }
     if (($id & 1) > 0) {
         $output['itemId'] = $object->itemId;
     }
     if (($id & 2) > 0 && isset($object->itemId)) {
         $output['itemId'] = $object->itemId;
     }
     if (($id & 1) > 0) {
         $output['name'] = $object->name;
     }
     if (($id & 2) > 0 && isset($object->name)) {
         $output['name'] = $object->name;
     }
     if (($id & 1) > 0) {
         $output['longName'] = $object->longName;
     }
     if (($id & 2) > 0 && isset($object->longName)) {
         $output['longName'] = $object->longName;
     }
     if (($id & 1) > 0) {
         $output['description'] = $object->description;
     }
     if (($id & 2) > 0 && isset($object->description)) {
         $output['description'] = $object->description;
     }
     if (($id & 1) > 0) {
         $output['url'] = $object->url;
     }
     if (($id & 2) > 0 && isset($object->url)) {
         $output['url'] = $object->url;
     }
     if (($id & 1) > 0) {
         $output['price'] = $object->price;
     }
     if (($id & 2) > 0 && isset($object->price)) {
         $output['price'] = $object->price;
     }
     if (($id & 1) > 0) {
         $output['deliveryDate'] = $object->deliveryDate;
     }
     if (($id & 2) > 0 && isset($object->deliveryDate)) {
         $output['deliveryDate'] = $object->deliveryDate;
     }
     if (($id & 1) > 0) {
         if (!(isset($output['images']) && is_array($output['images']))) {
             $output['images'] = array();
         }
         foreach ((array) $object->images as $k0 => $v0) {
             $output['images'][$k0] = ImageMeta::toObject($v0, $group);
         }
     }
     if (($id & 2) > 0 && isset($object->images)) {
         if (!(isset($output['images']) && is_array($output['images']))) {
             $output['images'] = array();
         }
         foreach ((array) $object->images as $k0 => $v0) {
             $output['images'][$k0] = ImageMeta::toObject($v0, $group);
         }
     }
     if (($id & 1) > 0) {
         $output['ean'] = $object->ean;
     }
     if (($id & 2) > 0 && isset($object->ean)) {
         $output['ean'] = $object->ean;
     }
     if (($id & 1) > 0) {
         $output['isbn'] = $object->isbn;
     }
     if (($id & 2) > 0 && isset($object->isbn)) {
         $output['isbn'] = $object->isbn;
     }
     if (($id & 1) > 0) {
         $output['productno'] = $object->productno;
     }
     if (($id & 2) > 0 && isset($object->productno)) {
         $output['productno'] = $object->productno;
     }
     if (($id & 1) > 0) {
         $output['manufacturer'] = $object->manufacturer;
     }
     if (($id & 2) > 0 && isset($object->manufacturer)) {
         $output['manufacturer'] = $object->manufacturer;
     }
     if (($id & 1) > 0) {
         $output['brand'] = $object->brand;
     }
     if (($id & 2) > 0 && isset($object->brand)) {
         $output['brand'] = $object->brand;
     }
     if (($id & 1) > 0) {
         if (!(isset($output['categoryTexts']) && is_array($output['categoryTexts']))) {
             $output['categoryTexts'] = array();
         }
         foreach ((array) $object->categoryTexts as $k0 => $v0) {
             $output['categoryTexts'][$k0] = $v0;
         }
     }
     if (($id & 2) > 0 && isset($object->categoryTexts)) {
         if (!(isset($output['categoryTexts']) && is_array($output['categoryTexts']))) {
             $output['categoryTexts'] = array();
         }
         foreach ((array) $object->categoryTexts as $k0 => $v0) {
             $output['categoryTexts'][$k0] = $v0;
         }
     }
     if (($id & 1) > 0) {
         if (!(isset($output['categoryIds']) && is_array($output['categoryIds']))) {
             $output['categoryIds'] = array();
         }
         foreach ((array) $object->categoryIds as $k0 => $v0) {
             $output['categoryIds'][$k0] = $v0;
         }
     }
     if (($id & 2) > 0 && isset($object->categoryIds)) {
         if (!(isset($output['categoryIds']) && is_array($output['categoryIds']))) {
             $output['categoryIds'] = array();
         }
         foreach ((array) $object->categoryIds as $k0 => $v0) {
             $output['categoryIds'][$k0] = (string) $v0;
         }
     }
     if (($id & 1) > 0) {
         if (!(isset($output['categories']) && is_array($output['categories']))) {
             $output['categories'] = array();
         }
         foreach ((array) $object->categories as $k0 => $v0) {
             $output['categories'][$k0] = CategoryMeta::toObject($v0, $group);
         }
     }
     if (($id & 2) > 0 && isset($object->categories)) {
         if (!(isset($output['categories']) && is_array($output['categories']))) {
             $output['categories'] = array();
         }
         foreach ((array) $object->categories as $k0 => $v0) {
             $output['categories'][$k0] = CategoryMeta::toObject($v0, $group);
         }
     }
     if (($id & 1) > 0) {
         $output['itemType'] = $object->itemType;
     }
     if (($id & 2) > 0 && isset($object->itemType)) {
         $output['itemType'] = $object->itemType;
     }
     if (($id & 1) > 0) {
         if (!(isset($output['extraMessages']) && is_array($output['extraMessages']))) {
             $output['extraMessages'] = array();
         }
         foreach ((array) $object->extraMessages as $k0 => $v0) {
             $output['extraMessages'][$k0] = $v0;
         }
     }
     if (($id & 2) > 0 && isset($object->extraMessages)) {
         if (!(isset($output['extraMessages']) && is_array($output['extraMessages']))) {
             $output['extraMessages'] = array();
         }
         foreach ((array) $object->extraMessages as $k0 => $v0) {
             $output['extraMessages'][$k0] = $v0;
         }
     }
     return (object) $output;
 }
 protected function createMeta()
 {
     return EshopMeta::getInstance();
 }