diff --git a/dibi/dibi.php b/dibi/dibi.php index aff38034..609fb650 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -638,9 +638,6 @@ class dibi */ public static function addSubst($expr, $subst) { - if ($expr === '') { - trigger_error(__METHOD__ . ': empty substitutions will probably be deprecated.', E_USER_NOTICE); - } self::$substs[$expr] = $subst; } @@ -656,7 +653,7 @@ class dibi if ($expr === TRUE) { self::$substs = array(); } else { - unset(self::$substs[$expr]); + unset(self::$substs[':'.$expr.':']); } } diff --git a/examples/using-substitutions.php b/examples/using-substitutions.php index 47f0e893..a87c94ae 100644 --- a/examples/using-substitutions.php +++ b/examples/using-substitutions.php @@ -26,6 +26,16 @@ dibi::test("SELECT * FROM [:blog:items]"); +// create new substitution :: (empty) ==> my_ +dibi::addSubst('', 'my_'); + +dibi::test("UPDATE ::table SET [text]='Hello World'"); +// -> UPDATE my_table SET [text]='Hello World' + + + + + // create substitutions using fallback callback function substFallBack($expr) {