Skip to content

Repository files navigation

Activerecord

Warning working on conforming to PSR-1 starting 5/11/2016 use Ver. 1.1

Instructions

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

namespaceModels;
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 ($barsas$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.

Updated 4/25/2016

A revised implementation of php-Activerecord by jpfuentes; Currently working but testing system incomplete.

Original Commit 12/9/2015

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.

About

activerecord is a revised implementation of php-activerecord by jpfuent an open source ORM library based on the ActiveRecord pattern.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages