A fast and light-weight component library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
758 B

7 years ago
<?php
7 years ago
namespace Twister\ORM;
7 years ago
7 years ago
abstract class Entity
7 years ago
{
7 years ago
protected $properties;
public $id;
7 years ago
7 years ago
function __construct(array $properties = null)
7 years ago
{
$this->properties =& $properties;
7 years ago
$this->id = $properties['id'] ?? null;
7 years ago
}
/**
* Get entity field/property
*
* @param string $name
* @return mixed
*/
7 years ago
function __get($name)
7 years ago
{
7 years ago
return $this->properties[$name];
7 years ago
}
/**
* Set entity field/property
*
* @param string $name
* @param mixed $value
* @return void
*/
7 years ago
function __set($name, $value)
7 years ago
{
$this->properties[$name] = $value;
}
7 years ago
function __isset($name)
7 years ago
{
return isset($this->properties[$name]);
}
7 years ago
function __unset($name)
7 years ago
{
unset($this->properties[$name]);
}
}