Created
November 9, 2009 07:59
-
-
Save sousk/229771 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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