Example #1
0
 /**
  * Returns a new PlayerQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param   PlayerQuery|Criteria $criteria Optional Criteria to build the query from
  *
  * @return PlayerQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof PlayerQuery) {
         return $criteria;
     }
     $query = new PlayerQuery(null, null, $modelAlias);
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Example #2
0
 /**
  * @return Player
  * @throws \PropelException
  */
 public function getCurrentPlayer()
 {
     $round = RoundQuery::create()->filterByGame($this)->orderById(\Criteria::DESC)->findOne();
     if (!$round) {
         return PlayerQuery::create()->filterByGame($this)->orderBySort()->findOne();
     }
     $nPlayers = $this->countPlayers();
     $sort = ($round->getPlayer()->getSort() + 1) % $nPlayers;
     return PlayerQuery::create()->filterByGame($this)->filterBySort($sort)->findOne();
 }
Example #3
0
function autoSuggest($query)
{
    Propel::init("..\\..\\config\\build\\conf\\bookingspace-conf.php");
    set_include_path("..\\..\\config\\build\\classes" . PATH_SEPARATOR . get_include_path());
    $players = PlayerQuery::create()->where('Player.firstName like ?', '%' . $query . '%')->orWhere('Player.lastName like ?', '%' . $query . '%')->find();
    $totalRows = $players->count();
    if ($totalRows > 0) {
        $items = '<ul class="div-table">';
        //  var_dump($players->toArray());
        foreach ($players->toArray() as $row) {
            $items .= '<li><div class="div-table-row">';
            $items .= '<div class="div-table-col col-img"><img src="' . PATH_PICS . $row['Photo'] . '" width="90" height="90" /> </div>';
            $items .= '<div class="div-table-col">' . $row['LastName'] . ' - ' . $row['FirstName'] . '<br />';
            $items .= 'Τηλ. Επικοιν' . $row['Phone'] . '<br />';
            $items .= 'Κινητο:' . $row['Mobile'] . '</div>';
            $items .= '</div></li>';
        }
        $items .= '</ul>';
        // echo $items;
    } else {
        $items = "Δεν υπάρχουν εγγραφές";
    }
    echo $items;
}
Example #4
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(PlayerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = PlayerQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Example #5
0
 /**
  * Get the associated Player object
  *
  * @param PropelPDO $con Optional Connection object.
  * @param $doQuery Executes a query to get the object if required
  * @return Player The associated Player object.
  * @throws PropelException
  */
 public function getPlayer(PropelPDO $con = null, $doQuery = true)
 {
     if ($this->aPlayer === null && $this->player_id !== null && $doQuery) {
         $this->aPlayer = PlayerQuery::create()->findPk($this->player_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->aPlayer->addPlayerCourts($this);
            */
     }
     return $this->aPlayer;
 }
Example #6
0
 /**
  * Gets the number of Player objects related by a many-to-many relationship
  * to the current object by way of the player_court cross-reference table.
  *
  * @param Criteria $criteria Optional query object to filter the query
  * @param boolean $distinct Set to true to force count distinct
  * @param PropelPDO $con Optional connection object
  *
  * @return int the number of related Player objects
  */
 public function countPlayers($criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if (null === $this->collPlayers || null !== $criteria) {
         if ($this->isNew() && null === $this->collPlayers) {
             return 0;
         } else {
             $query = PlayerQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByCourt($this)->count($con);
         }
     } else {
         return count($this->collPlayers);
     }
 }