This repository has been archived on 2024-10-04. You can view files and clone it, but cannot push or open issues or pull requests.
AroMVC/index.php

36 lines
922 B
PHP
Raw Normal View History

2017-02-24 16:39:37 +00:00
<?php
namespace AroMVC;
2017-02-27 21:57:15 +00:00
use AroMVC\Core\Database;
2017-02-24 16:39:37 +00:00
use AroMVC\Core\Selectable;
use AroMVC\Models\Company;
2017-02-24 22:01:32 +00:00
spl_autoload_register(function($class) {
$class = str_replace("_", "\\", $class);
$class = ltrim($class, '\\');
$parts = explode("\\", $class);
if($parts[0] == "AroMVC") {
if(count($parts) < 3)
die("Autoloader failed: malformed class name $class");
if($parts[1] == "Core")
require_once "AroMVC". DIRECTORY_SEPARATOR . $parts[2] .".php";
else if(in_array($parts[1], ["Controllers", "Models", "ViewModels"]))
require_once $parts[1]. DIRECTORY_SEPARATOR. $parts[2] .".php";
else
die("Autoloader failed: malformed class name $class");
}
});
2017-02-27 21:57:15 +00:00
Database::initialize();
/*$tmp = new Selectable("*");
2017-02-24 16:39:37 +00:00
$tmp->from("Companies")
->where("`name` = ?")
->or("`id` = ?")
2017-02-24 22:01:32 +00:00
->execute()
2017-02-27 21:57:15 +00:00
->asModels(new Company);*/