Beispiel #1
0
 /**
  * Creates wrapper for given house element.
  * 
  * @version 0.2.0+SVN
  * @since 0.1.0
  * @param DOMElement $element House information.
  * @throws PDOException On PDO operation error.
  */
 public function __construct(DOMElement $element)
 {
     parent::__construct();
     $this->element = $element;
     // loads SQL part - `id` field is not needed as we have it from XML
     $this->data = $this->db->query('SELECT ' . $this->db->fieldName('townid') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('rent') . ', ' . $this->db->fieldName('guildhall') . ', ' . $this->db->fieldName('tiles') . ', ' . $this->db->fieldName('doors') . ', ' . $this->db->fieldName('beds') . ', ' . $this->db->fieldName('lastwarning') . ', ' . $this->db->fieldName('paid') . ', ' . $this->db->fieldName('owner') . ', ' . $this->db->fieldName('warnings') . ' FROM ' . $this->db->tableName('houses') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->getId())->fetch();
 }
Beispiel #2
0
 /**
  * Handles automatic loading for record.
  * 
  * <p>
  * You can call class constructor with optional parameter which can be either of integer type (then it will be treated as primary key value) or string type (then it will be used as name identifier).
  * </p>
  * 
  * <p>
  * Note: Make sure that you pass <var>$id</var> argument of correct type. This method determinates action which should be taken based on variable type. It means that 1 is primary key value, but '1' is name value.
  * </p>
  * 
  * @param int|string|null $id Row ID (or name identifier dependend on child class).
  */
 public function __construct($id = null)
 {
     parent::__construct();
     // checks if row identifier is set
     if (isset($id)) {
         // checks if it's ID, or name identifier
         if (is_int($id)) {
             $this->load($id);
         } else {
             $this->find($id);
         }
     }
 }
Beispiel #3
0
 public function __construct($id)
 {
     parent::__construct();
     $this->load($id);
 }