entity.php
public static function load($param)
    {
        $row  = array();
        $class = get_called_class();

        $meta = $class::getMetadata();
        $table = isset($meta['view']) ? $meta['view'] : $meta['table'];
        $conn = DB::getConnect();
        if (is_numeric($param)) {
            $row = $conn->GetRow("select * from {$table}  where {$meta['keyfield']} = " . $param);
        } else
            if (is_array($param)) {
                $row = $param;
            }

        if (count($row) == 0) {
            return null;
        }
        $obj = new $class();
        $obj->fields = array_merge($obj->fields, $row);
        $obj->afterLoad();
        return $obj;
    }
public static function load($param)
    {
        $row  = array();
        $class = get_called_class();

        $meta = $class::getMetadata();
        $table = isset($meta['view']) ? $meta['view'] : $meta['table'];
        $conn = DB::getConnect();
        if (is_numeric($param)) {
            $row = $conn->GetRow("select * from {$table}  where {$meta['keyfield']} = " . $param);
        } else
            if (is_array($param)) {
                $row = $param;
            }

        if (count($row) == 0) {
            return null;
        }
        $obj = new $class();
        $obj->fields = array_merge($obj->fields, $row);
        $obj->afterLoad();
        return $obj;
    }
Возвращает  сущность  из  БД по  ключу
@param mixed $param