Exemplo n.º 1
0
 /**
  * Returns house rented by this player.
  * 
  * <p>
  * You need global houses list resource loaded in order to use this method.
  * </p>
  * 
  * @version 0.2.0+SVN
  * @since 0.1.0
  * @return OTS_House|null House rented by player.
  * @throws E_OTS_NotLoaded If player is not loaded or global houses list is not loaded.
  * @throws PDOException On PDO operation error.
  */
 public function getHouse()
 {
     if (!isset($this->data['id'])) {
         throw new E_OTS_NotLoaded();
     }
     // SELECT query on database
     $house = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('houses') . ' WHERE ' . $this->db->fieldName('owner') . ' = ' . $this->data['id'])->fetch();
     if (!empty($house)) {
         return POT::getHousesList()->getHouse($house['id']);
     }
     return null;
 }