File: D:/HostingSpaces/NVonken/mijneigenlied.com/wwwroot/Core/Domain/File.php
<?php
class File extends BaseClass
{
////////////////
// Properties //
////////////////
public $Id;
public $Name;
public $Extension;
public $Created;
public $Modified;
public static $_primaryKey = array("Id");
/*
* Public methods
*/
/**
* Inserts a file
*/
public function Insert()
{
$this->Created = microtime(true);
$this->Modified = microtime(true);
return (int)parent::Insert($this);
}
/**
* Updates an file
*/
public function Update()
{
$this->Modified = microtime(true);
parent::Update();
}
/**
* Selects an file by id
* @static
* @param int $id
* @return file
*/
public static function Select($id)
{
return parent::Select(intval($id));
}
/**
* Selects all filees
* @static
* @return file[]
*/
public static function SelectAll()
{
return parent::SelectAll();
}
/**
* Deletes a file
*/
public function Delete()
{
parent::Delete();
}
/**
* Selects files by filename
* @static
* @param string $fileName
* @return File
*/
public static function SelectByName($fileName)
{
return reset(parent::SelectObjects("SELECT *
FROM `File`
WHERE Name = '" . parent::_db()->escape($fileName) . "'"));
}
/**
* Checks for existing file names
* @static
* @param string $fileName
* @return File[]
*/
public static function FindName($fileName)
{
return parent::SelectObjects("SELECT *
FROM `File`
WHERE Name LIKE '%" . parent::_db()->escape($fileName) . "%'");
}
}
?>