File: D:/HostingSpaces/NVonken/mijneigenlied.com/wwwroot/Core/Domain/NewsItem.php
<?php
/**
* Represents a NewsItem
* @added 6-11-2012
* @modified 6-11-2012
* @dependencies - Component: news.com.php
* - Element: news.element.php
*/
class NewsItem extends BaseClass
{
////////////////
// Properties //
////////////////
public $Id;
public $UserId;
public $Created;
public $Modified;
public static $_primaryKey = array("Id");
////////////////////
// Public Methods //
////////////////////
public function __construct()
{
General::Load("NewsItemTranslation");
}
/**
* Select a single news item by id
* @static
* @param $Id
* @return Order
*/
public static function Select($Id)
{
return parent::Select($Id);
}
/**
* Selects a list of NewsItems
* @param int|null $limit
* @return News{]
*/
public static function SelectAll($limit = null)
{
$limitClause = "";
if ($limit != null && is_numeric($limit))
$limitClause = " LIMIT 0, " . $limit;
return parent::SelectObjects("SELECT *
FROM NewsItem
ORDER BY Created DESC" . $limitClause);
}
/**
* Deletes a NewsItem and it's translations
*/
public function Delete()
{
NewsItemTranslation::DeleteByNewsItem($this->Id);
parent::Delete();
}
/**
* Inserts a news item
* @return int Last inserted id
*/
public function Insert()
{
$this->Created = microtime(true);
$this->Modified = microtime(true);
return parent::Insert($this);
}
/**
* Updates a news item
*/
public function Update()
{
$this->Modified = microtime(true);
parent::Update();
}
}
?>