Skip to content

Instantly share code, notes, and snippets.

@sousk
Created November 9, 2009 07:59
Show Gist options
  • Save sousk/229771 to your computer and use it in GitHub Desktop.
Save sousk/229771 to your computer and use it in GitHub Desktop.
public static function getCriteria($c=null)
{
if (! $c) {
$c = new Criteria;
}
return $c;
}
public static function retrieveBy($col, $value)
{
static $ref;
if (! $ref) {
$ref = new ReflectionClass(__CLASS__);
}
$c = self::getCriteria();
$c->add($ref->getConstant(strtoupper($col)), $value);
return self::doSelectOne($c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment