/** * Retrieve object using using composite pkey values. * @param int $klient_id * @param int $grupa_id * @param PropelPDO $con * @return KlientGrupa */ public static function retrieveByPK($klient_id, $grupa_id, PropelPDO $con = null) { $key = serialize(array((string) $klient_id, (string) $grupa_id)); if (null !== ($obj = KlientGrupaPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(KlientGrupaPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(KlientGrupaPeer::DATABASE_NAME); $criteria->add(KlientGrupaPeer::KLIENT_ID, $klient_id); $criteria->add(KlientGrupaPeer::GRUPA_ID, $grupa_id); $v = KlientGrupaPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
?> </td> </tr> <tr> <th>Utworzono:</th> <td><?php echo $Klient->getCreatedAt(); ?> </td> </tr> <tr> <th>Grupy:</th> <td><?php $c = new Criteria(); $c->add(KlientGrupaPeer::KLIENT_ID, $Klient->getId()); $grupy = KlientGrupaPeer::doSelect($c); foreach ($grupy as $g) { $grup = GrupaPeer::retrieveByPK($g->getGrupaId()); echo $grup; echo ', '; } ?> </td> </tr> <tr> <th>Cykl:</th> <td><?php $c = new Criteria(); $c->add(CyklPeer::ID, $Klient->getCykl()); $cyk = CyklPeer::doSelectOne($c); echo $cyk;
/** * Gets an array of KlientGrupa 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 Grupa has previously been saved, it will retrieve * related KlientGrupas from storage. If this Grupa 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 KlientGrupa[] * @throws PropelException */ public function getKlientGrupas($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(GrupaPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collKlientGrupas === null) { if ($this->isNew()) { $this->collKlientGrupas = array(); } else { $criteria->add(KlientGrupaPeer::GRUPA_ID, $this->id); KlientGrupaPeer::addSelectColumns($criteria); $this->collKlientGrupas = KlientGrupaPeer::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(KlientGrupaPeer::GRUPA_ID, $this->id); KlientGrupaPeer::addSelectColumns($criteria); if (!isset($this->lastKlientGrupaCriteria) || !$this->lastKlientGrupaCriteria->equals($criteria)) { $this->collKlientGrupas = KlientGrupaPeer::doSelect($criteria, $con); } } } $this->lastKlientGrupaCriteria = $criteria; return $this->collKlientGrupas; }