public static function find($id) 
    {
        self::_checkLoaded();

        $pk               = self::isIgnoringCase() ? strtolower(self::getPK()) : self::getPK();
        $builder          = self::_makeBuilder();
        $builder->fields  = self::extractColumns();
        $builder->where   = self::_extractWhereConditions(array($pk=>$id));
        $builder->limit   = 1;

        $cls  = get_called_class();
        $stmt = self::executePrepared($builder, array($id));
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);

        if (!$data) {
            return null;
        }
        return new $cls($data);
    }
public static function find($id) 
    {
        self::_checkLoaded();

        $pk               = self::isIgnoringCase() ? strtolower(self::getPK()) : self::getPK();
        $builder          = self::_makeBuilder();
        $builder->fields  = self::extractColumns();
        $builder->where   = self::_extractWhereConditions(array($pk=>$id));
        $builder->limit   = 1;

        $cls  = get_called_class();
        $stmt = self::executePrepared($builder, array($id));
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);

        if (!$data) {
            return null;
        }
        return new $cls($data);
    }
public static function find ( $ id ) { self :: _checkLoaded ( ) ; $ pk = self :: isIgnoringCase ( ) ? strtolower ( self :: getPK ( ) ) : self :: getPK ( ) ; $ builder = self :: _makeBuilder ( ) ; $ builder -> fields = self :: extractColumns ( ) ; $ builder -> where = self :: _extractWhereConditions ( array ( $ pk => $ id ) ) ; $ builder -> limit = 1 ; $ cls = get_called_class ( ) ; $ stmt = self :: executePrepared ( $ builder , array ( $ id ) ) ; $ data = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ; if ( ! $ data ) { return null ; } return new $ cls ( $ data ) ; }
Find an object by its primary key

@param object $id primary key

@return mixed result
Find an object by its primary key