<?php
class WeightReading extends DBObject {
	public static function GetAll($userId){
		$readings=array();
		self::SetupPDO();
		$ids=self::$PDO->query("SELECT reading_id FROM weight_readings WHERE user_id=".(int)$userId)->fetchAll(PDO::FETCH_COLUMN);
		foreach ($ids as $id)
			$readings[]=new WeightReading($id);
		return $readings;
	}
	
	public function __construct($id=0) {
		parent::__construct("weight_readings", "reading_id", $id);
	}
	
	public function GetParsedDate(){
		return date_parse($this->Timestamp);
	}
}
