/**
  * Returns a new CustomersQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param   CustomersQuery|Criteria $criteria Optional Criteria to build the query from
  *
  * @return CustomersQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof CustomersQuery) {
         return $criteria;
     }
     $query = new CustomersQuery(null, null, $modelAlias);
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
 /**
  * Get the associated Customers object
  *
  * @param PropelPDO $con Optional Connection object.
  * @param $doQuery Executes a query to get the object if required
  * @return Customers The associated Customers object.
  * @throws PropelException
  */
 public function getCustomers(PropelPDO $con = null, $doQuery = true)
 {
     if ($this->aCustomers === null && $this->id_customers !== null && $doQuery) {
         $this->aCustomers = CustomersQuery::create()->findPk($this->id_customers, $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->aCustomers->addTransaksis($this);
            */
     }
     return $this->aCustomers;
 }
Example #3
0
 /**
  * Returns the number of related Customers objects.
  *
  * @param Criteria $criteria
  * @param boolean $distinct
  * @param PropelPDO $con
  * @return int             Count of related Customers objects.
  * @throws PropelException
  */
 public function countCustomerss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     $partial = $this->collCustomerssPartial && !$this->isNew();
     if (null === $this->collCustomerss || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collCustomerss) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getCustomerss());
         }
         $query = CustomersQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByKota($this)->count($con);
     }
     return count($this->collCustomerss);
 }