Warning working on conforming to PSR-1 starting 5/11/2016 use Ver. 1.1
Uses Composer to manage autoload. In bootstrap file assuming root directory.
$loader = require_once 'vendor/autoload.php';
$loader->addPsr4('Models\\', __dir__.'\Models');
// What? Why? Composers base path is vendor and I don't want to update Composer for every new Model.
//Simple Config
$cfg = Activerecord\Config::instance();
$cfg->setConnections(array(
'development' =>
'mysql://root:root@localhost/treebark?charset=utf8'));
Model classes
namespace Models;
class Bar \\ for table name bars by convention
extends \Activerecord\Model \\ leading slash required
{
}
Super Simple Usage Example:
$bars = Models\Bar::find(1)->to_array();
echo $bars['name'];
echo '<br>';
$bars = Models\Bar::all();
foreach ($bars as $bar)
{
echo '<br> id:';
echo $bar->id;
echo '<br> Name of Bar:';
echo $bar->name;
echo '<br> Address:';
echo $bar->address;
echo '<br>';
}
The php-Activerecord.org instructions for use remain the same.
A revised implementation of php-Activerecord by jpfuentes; Currently working but testing system incomplete.
A revised implementation of php-Activerecord by jpfuentes This is an inprocess version testing is not complete. So far the php-Activerecord.org instructions for use remain the same.