Пример #1
0
 /**
  * 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 = ChildEmployeeQuery::create();
     $criteria->add(EmployeeTableMap::COL_ID, $this->id);
     return $criteria;
 }
Пример #2
0
 /**
  * Get the associated ChildEmployee object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildEmployee The associated ChildEmployee object.
  * @throws PropelException
  */
 public function getEmployee(ConnectionInterface $con = null)
 {
     if ($this->aEmployee === null && $this->employee_id !== null) {
         $this->aEmployee = ChildEmployeeQuery::create()->findPk($this->employee_id, $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->aEmployee->addProjects($this);
            */
     }
     return $this->aEmployee;
 }
Пример #3
0
 /**
  * Returns the number of related Employee objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related Employee objects.
  * @throws PropelException
  */
 public function countEmployees(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collEmployeesPartial && !$this->isNew();
     if (null === $this->collEmployees || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collEmployees) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getEmployees());
         }
         $query = ChildEmployeeQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByPerson($this)->count($con);
     }
     return count($this->collEmployees);
 }