/**
  * @param ChildFitEntry $fitEntry The ChildFitEntry object to add.
  */
 protected function doAddFitEntry(ChildFitEntry $fitEntry)
 {
     $this->collFitEntries[] = $fitEntry;
     $fitEntry->setFitEntryType($this);
 }
 protected function performSave($data, $fork)
 {
     $fitEntryType = array();
     $fitEntryTypes1 = ECP\FitEntryTypeQuery::create()->find();
     foreach ($fitEntryTypes1 as $fitEntryType1) {
         $fitEntryType[$fitEntryType1->getName()] = $fitEntryType1->getId();
     }
     $entity = $this->getLocalyMappedEntityToSave($data, $fork);
     $connection = $this->getPropelConnection();
     try {
         $connection->beginTransaction();
         $entity->setRulesetEntityId($data->ruleset->id);
         foreach ($data->content as $dataRow) {
             $compositionRow = $this->getSubentity($entity, 'CompositionRow', $dataRow);
             $compositionRow->setShipId($dataRow->shipId);
             $compositionRow->setNotes(property_exists($dataRow, 'notes') ? $dataRow->notes : '');
             $dataFitContent = $dataRow->fit->content;
             $compositionRow->setFitName($dataFitContent->header->shipName);
             $fitEntries = $compositionRow->getFitEntries();
             $fitEntryIndex = 0;
             foreach ($dataFitContent->body as $dataFitEntry) {
                 $fitEntryExists = count($fitEntries) > $fitEntryIndex;
                 $fitEntry = null;
                 if ($fitEntryExists) {
                     $fitEntry = $fitEntries[$fitEntryIndex];
                 } else {
                     $fitEntry = new ECP\FitEntry();
                     $fitEntry->setInd3x($fitEntryIndex);
                 }
                 $fitEntry->setFitEntryTypeId($fitEntryType[property_exists($dataFitEntry, 'type') ? $dataFitEntry->type : 'none']);
                 $fitEntry->setItemId(property_exists($dataFitEntry, 'item') ? $dataFitEntry->item : 0);
                 $fitEntry->setAmmoId(property_exists($dataFitEntry, 'ammo') ? $dataFitEntry->ammo : 0);
                 $fitEntry->setAmount(property_exists($dataFitEntry, 'amount') ? $dataFitEntry->amount : 0);
                 $this->prepareSubentitySave2($connection, $compositionRow, 'FitEntry', $fitEntry, !$fitEntryExists);
                 $fitEntryIndex++;
             }
             for (; $fitEntryIndex < count($fitEntries); $fitEntryIndex++) {
                 $compositionRow->removeFitEntry($fitEntries[$fitEntryIndex]);
             }
             $this->prepareSubentitySave($connection, $entity, 'CompositionRow', $compositionRow, $dataRow);
         }
         $this->cleanupOldEnties($entity, 'CompositionRow', $data->content);
         $this->saveGroupAccess($connection, $entity, $data);
         $entity->save($connection);
         $connection->commit();
         return $this->createIdObj($entity->getId());
     } catch (Exception $e) {
         $connection->rollBack();
         throw $e;
     }
 }
 /**
  * Filter the query by a related \ECP\FitEntry object
  *
  * @param \ECP\FitEntry|ObjectCollection $fitEntry the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCompositionRowQuery The current query, for fluid interface
  */
 public function filterByFitEntry($fitEntry, $comparison = null)
 {
     if ($fitEntry instanceof \ECP\FitEntry) {
         return $this->addUsingAlias(CompositionRowTableMap::COL_ID, $fitEntry->getCompositionrowid(), $comparison);
     } elseif ($fitEntry instanceof ObjectCollection) {
         return $this->useFitEntryQuery()->filterByPrimaryKeys($fitEntry->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByFitEntry() only accepts arguments of type \\ECP\\FitEntry or Collection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildFitEntry $fitEntry Object to remove from the list of results
  *
  * @return $this|ChildFitEntryQuery The current query, for fluid interface
  */
 public function prune($fitEntry = null)
 {
     if ($fitEntry) {
         $this->addUsingAlias(FitEntryTableMap::COL_ID, $fitEntry->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * @param ChildFitEntry $fitEntry The ChildFitEntry object to add.
  */
 protected function doAddFitEntry(ChildFitEntry $fitEntry)
 {
     $this->collFitEntries[] = $fitEntry;
     $fitEntry->setCompositionRow($this);
 }