public function read ($pkValue = FALSE, &$db = FALSE)
	{
		
		try
		{
			
			// If there is a key value passed set it

			if ($pkValue !== FALSE)
			{
				$this->iset (static::$pk, $pkValue);
			}
			
			// Get database slave for read

			if ($db === FALSE)
			{
				$db	=& $this->getDbSlave ();
			}

			// Prepare query

			$query = $db->prepare ('
			SELECT * FROM `' . static::$dbTable . '`
			WHERE ' . static::$pk . ' = :pk
			');

			// Bind paramater

			$query->bindValue (':pk',	$this->iget (static::$pk));

			// Execute

			$query->execute ();

			// Set row

			$row	= $query->fetch (\PDO::FETCH_ASSOC);

			// If no data was returned return FALSE

			if (!$row)
			{
				return FALSE;
			}

			// Set each attribute value

			foreach ($row as $name => $val)
			{

				if ($this->attributeExists ($name))
				{
					$this->iset ($name, $val, FALSE, TRUE);
				}

			}
			
		}
		
		// Set errors as framework messages

		catch (Resource\Parser\Exception $e)
		{
			new Message ('error', $e->getMessage ());
			return FALSE;
		}
		
		// Return TRUE

		return TRUE;
		
	}
public function read ($pkValue = FALSE, &$db = FALSE)
	{
		
		try
		{
			
			// If there is a key value passed set it

			if ($pkValue !== FALSE)
			{
				$this->iset (static::$pk, $pkValue);
			}
			
			// Get database slave for read

			if ($db === FALSE)
			{
				$db	=& $this->getDbSlave ();
			}

			// Prepare query

			$query = $db->prepare ('
			SELECT * FROM `' . static::$dbTable . '`
			WHERE ' . static::$pk . ' = :pk
			');

			// Bind paramater

			$query->bindValue (':pk',	$this->iget (static::$pk));

			// Execute

			$query->execute ();

			// Set row

			$row	= $query->fetch (\PDO::FETCH_ASSOC);

			// If no data was returned return FALSE

			if (!$row)
			{
				return FALSE;
			}

			// Set each attribute value

			foreach ($row as $name => $val)
			{

				if ($this->attributeExists ($name))
				{
					$this->iset ($name, $val, FALSE, TRUE);
				}

			}
			
		}
		
		// Set errors as framework messages

		catch (Resource\Parser\Exception $e)
		{
			new Message ('error', $e->getMessage ());
			return FALSE;
		}
		
		// Return TRUE

		return TRUE;
		
	}
public function read ( $ pkValue = FALSE , & $ db = FALSE ) { try { // If there is a key value passed set it if ( $ pkValue !== FALSE ) { $ this -> iset ( static :: $ pk , $ pkValue ) ; } // Get database slave for read if ( $ db === FALSE ) { $ db = & $ this -> getDbSlave ( ) ; } // Prepare query $ query = $ db -> prepare ( '
			SELECT * FROM `' . static :: $ dbTable . '`
			WHERE ' . static :: $ pk . ' = :pk
			' ) ; // Bind paramater $ query -> bindValue ( ':pk' , $ this -> iget ( static :: $ pk ) ) ; // Execute $ query -> execute ( ) ; // Set row $ row = $ query -> fetch ( \ PDO :: FETCH_ASSOC ) ; // If no data was returned return FALSE if ( ! $ row ) { return FALSE ; } // Set each attribute value foreach ( $ row as $ name => $ val ) { if ( $ this -> attributeExists ( $ name ) ) { $ this -> iset ( $ name , $ val , FALSE , TRUE ) ; } } } // Set errors as framework messages catch ( Resource \ Parser \ Exception $ e ) { new Message ( 'error' , $ e -> getMessage ( ) ) ; return FALSE ; } // Return TRUE return TRUE ; }
Read an object from the database, populating the object attributes
@param mixed $pkValue Primary key value
@param \PDO $db Database connection to use, default to slave resource
@return boolean
Read an object from the database populating the object attributes