/**
  * Get the associated ChildInvGroups object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildInvGroups The associated ChildInvGroups object.
  * @throws PropelException
  */
 public function getInvGroups(ConnectionInterface $con = null)
 {
     if ($this->aInvGroups === null && $this->groupid !== null) {
         $this->aInvGroups = ChildInvGroupsQuery::create()->findPk($this->groupid, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aInvGroups->addInvTypess($this);
            */
     }
     return $this->aInvGroups;
 }
 /**
  * Returns the number of related InvGroups objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related InvGroups objects.
  * @throws PropelException
  */
 public function countInvGroupss(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collInvGroupssPartial && !$this->isNew();
     if (null === $this->collInvGroupss || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collInvGroupss) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getInvGroupss());
         }
         $query = ChildInvGroupsQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByInvCategories($this)->count($con);
     }
     return count($this->collInvGroupss);
 }
 /**
  * Returns a new ChildInvGroupsQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildInvGroupsQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildInvGroupsQuery) {
         return $criteria;
     }
     $query = new ChildInvGroupsQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
 public function getShipGroups()
 {
     $groups = EVE\InvGroupsQuery::create()->useInvCategoriesQuery()->filterByCategoryname('Ship')->filterByPublished(1)->endUse()->filterByPublished(1)->leftJoinWith('InvGroups.InvTypes')->orderByGroupName()->orderBy('InvTypes.typeName')->find();
     $resultGroup = array();
     foreach ($groups as $group) {
         $types = $group->getInvTypess();
         $contentTypes = array();
         foreach ($types as $type) {
             if ($type->getPublished() == 0) {
                 continue;
             }
             $contentTypes[] = (object) array('id' => $type->getTypeID(), 'name' => $type->getTypeName());
         }
         $resultGroup[] = (object) array('name' => $group->getGroupName(), 'content' => $contentTypes);
     }
     return $resultGroup;
 }
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @throws LogicException if no primary key is defined
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = ChildInvGroupsQuery::create();
     $criteria->add(InvGroupsTableMap::COL_GROUPID, $this->groupid);
     return $criteria;
 }
 /**
  * Performs an INSERT on the database, given a InvGroups or Criteria object.
  *
  * @param mixed               $criteria Criteria or InvGroups object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(InvGroupsTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from InvGroups object
     }
     if ($criteria->containsKey(InvGroupsTableMap::COL_GROUPID) && $criteria->keyContainsValue(InvGroupsTableMap::COL_GROUPID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . InvGroupsTableMap::COL_GROUPID . ')');
     }
     // Set the correct dbName
     $query = InvGroupsQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }