”`php // Chaining methods $short = $users[‘completed’]->count()->to_sql();
// Expanded version $node = new NodeSQLLiteral(‘users.completed’); $count = $node->count();
$visitor = new SQLVisitor(); $expanded = $visitor->accept($count);
// Both examples produce: COUNT(users.completed) “”
I decided to go in a completely different direction with the code on this project. The previous example I posted yesterday was flexible. The last 24 hours has been a lot of theory. I have been deconstructing Arel and slowly porting it too PHP. The goal of this project is to provide a PHP equivalent of Arel.