$lastIntId = null;
 foreach ($entries as $entry) {
     /* @var $entry entry */
     $categoriesCriteria = new Criteria();
     $categoriesCriteria->add(categoryPeer::ID, $entry->getCategoriesIds(), Criteria::IN);
     $categories = categoryPeer::doSelect($categoriesCriteria);
     $categoryIds = array();
     foreach ($categories as $category) {
         /* @var $category category */
         $categoryIds[] = $category->getId();
     }
     $categoryEntriesCriteria = new Criteria();
     $categoryEntriesCriteria->addSelectColumn(categoryEntryPeer::CATEGORY_ID);
     $categoryEntriesCriteria->add(categoryEntryPeer::ENTRY_ID, $entry->getId());
     $categoryEntriesCriteria->add(categoryEntryPeer::CATEGORY_ID, $categoryIds, Criteria::IN);
     $stmt = categoryEntryPeer::doSelectStmt($categoryEntriesCriteria);
     $categoryEntriesIds = $stmt->fetchAll(PDO::FETCH_COLUMN);
     KalturaStatement::setDryRun($dryRun);
     foreach ($categories as $category) {
         /* @var $category category */
         $entryId = $entry->getId();
         $categoryId = $category->getId();
         if (in_array($categoryId, $categoryEntriesIds)) {
             KalturaLog::debug("CategoryEntry already exists for entry [{$entryId}] and category [{$categoryId}]");
             continue;
         }
         $categoryEntry = new migrationCategoryEntry();
         $categoryEntry->setEntryId($entryId);
         $categoryEntry->setCategoryId($categoryId);
         $categoryEntry->setPartnerId($entry->getPartnerId());
         $categoryEntry->setCategoryFullIds($category->getFullIds());
 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(categoryEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     categoryEntryPeer::setUseCriteriaFilter(false);
     $stmt = categoryEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     categoryEntryPeer::setUseCriteriaFilter(true);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
     }
     // if (deep)
 }