From f651d9f4730e82be393c02d841a77bf1e1ff93d6 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 5 Aug 2010 23:55:59 +0200 Subject: [PATCH] Revert "empty substitutions are going to be deprecated" commit e50b1a0b5acbf356f3ff811676ac37c383c2ada0. --- dibi/dibi.php | 5 +---- examples/using-substitutions.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) 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) {