Esempio n. 1
0
 /**
  * Gets an array of ModuleHook objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Module has previously been saved, it will retrieve
  * related ModuleHooks from storage. If this Module is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array ModuleHook[]
  * @throws     PropelException
  */
 public function getModuleHooks($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ModulePeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collModuleHooks === null) {
         if ($this->isNew()) {
             $this->collModuleHooks = array();
         } else {
             $criteria->add(ModuleHookPeer::MODULE, $this->id);
             ModuleHookPeer::addSelectColumns($criteria);
             $this->collModuleHooks = ModuleHookPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(ModuleHookPeer::MODULE, $this->id);
             ModuleHookPeer::addSelectColumns($criteria);
             if (!isset($this->lastModuleHookCriteria) || !$this->lastModuleHookCriteria->equals($criteria)) {
                 $this->collModuleHooks = ModuleHookPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastModuleHookCriteria = $criteria;
     return $this->collModuleHooks;
 }