Skip to content

Instantly share code, notes, and snippets.

@francescoagati
Created June 12, 2011 15:53
Show Gist options
  • Save francescoagati/1021693 to your computer and use it in GitHub Desktop.
Save francescoagati/1021693 to your computer and use it in GitHub Desktop.
transition with idiorm php pharen and lambda function
(fn transiction (callback)
(-> (:: ORM get_db) (beginTransaction))
($callback ORM)
(-> (:: ORM get_db) (commit))
)
(transition (lambda (orm) (print_r orm)))
<?php
require_once('/Users/Francesco/Downloads/Scriptor-pharen-aea8dc4/lang.php');
Lexical::$scopes['bindings'] = array();
function transiction($callback){
ORM::$get_db->beginTransaction();
(is_string($callback)?$callback(ORM):$callback[0](ORM, $callback[1]));
return ORM::$get_db->commit();
}
function bindings__lambdafunc7($orm, $__closure_id){
return print_r($orm);
}
transition(array("bindings__lambdafunc7", Lexical::get_closure_id("bindings", Null)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment