Model.class.php
public function load( $id )
	{

		$this->isNew = false;

		$dbr = wfGetDB( DB_SLAVE );

		/* Fetch entity by id */
		$entity = $dbr->selectRow( static::$table,
			'*',
			array( 'id' => intval( $id ) )
		);

		if ( !$entity ) {
			$this->error = true;
			return false;
			throw new Exception(get_called_class() . ": there is no entity with id = $id in table " . static::$table);
		}

		/* Set all properties by $properties array */
		foreach ( $this->properties as $prop => $type ) {

			if ( !isset($entity->$prop) && $entity->$prop !== null ) throw new Exception(get_called_class() . ": No such field $prop in table " . static::$table . ".");

			if ( $prop == 'id' ) {
				$this->id = $entity->$prop;
				continue;
			}

			/* Data type: int or string */
			if ( $type == 'int' ) {
				$this->values[$prop] = intval( $entity->$prop );
			} else {
				$this->values[$prop] = $entity->$prop;
			}

		}

		return true;

	}
public function load( $id )
	{

		$this->isNew = false;

		$dbr = wfGetDB( DB_SLAVE );

		/* Fetch entity by id */
		$entity = $dbr->selectRow( static::$table,
			'*',
			array( 'id' => intval( $id ) )
		);

		if ( !$entity ) {
			$this->error = true;
			return false;
			throw new Exception(get_called_class() . ": there is no entity with id = $id in table " . static::$table);
		}

		/* Set all properties by $properties array */
		foreach ( $this->properties as $prop => $type ) {

			if ( !isset($entity->$prop) && $entity->$prop !== null ) throw new Exception(get_called_class() . ": No such field $prop in table " . static::$table . ".");

			if ( $prop == 'id' ) {
				$this->id = $entity->$prop;
				continue;
			}

			/* Data type: int or string */
			if ( $type == 'int' ) {
				$this->values[$prop] = intval( $entity->$prop );
			} else {
				$this->values[$prop] = $entity->$prop;
			}

		}

		return true;

	}
public function load ( $ id ) { $ this -> isNew = false ; $ dbr = wfGetDB ( DB_SLAVE ) ; /* Fetch entity by id */ $ entity = $ dbr -> selectRow ( static :: $ table , '*' , array ( 'id' => intval ( $ id ) ) ) ; if ( ! $ entity ) { $ this -> error = true ; return false ; throw new Exception ( get_called_class ( ) . ": there is no entity with id = $id in table " . static :: $ table ) ; } /* Set all properties by $properties array */ foreach ( $ this -> properties as $ prop => $ type ) { if ( ! isset ( $ entity -> $ prop ) && $ entity -> $ prop !== null ) throw new Exception ( get_called_class ( ) . ": No such field $prop in table " . static :: $ table . "." ) ; if ( $ prop == 'id' ) { $ this -> id = $ entity -> $ prop ; continue ; } /* Data type: int or string */ if ( $ type == 'int' ) { $ this -> values [ $ prop ] = intval ( $ entity -> $ prop ) ; } else { $ this -> values [ $ prop ] = $ entity -> $ prop ; } } return true ; }
Loads entity from database.

@param $id
@return bool
@throws Exception
Loads entity from database .