diff options
| author | 2013-04-17 19:45:16 +0200 | |
|---|---|---|
| committer | 2013-04-17 19:45:16 +0200 | |
| commit | ae7c9787cd8afd4313d356c6525e40d4ce79f99b (patch) | |
| tree | dbac8b756486c5266e914026ef5a679002d0eb85 /app/models/Category.php | |
| parent | 044908439bdd7280f7539e12441d7dfa6c4d4c63 (diff) | |
| parent | 23dd73ddeec2473c3e8a3c517317e074ac53a1d8 (diff) | |
Merge branch 'releases'0.2.0
Diffstat (limited to 'app/models/Category.php')
| -rwxr-xr-x | app/models/Category.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/Category.php b/app/models/Category.php index d7db8ee65..7ce572e71 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -77,6 +77,8 @@ class CategoryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -94,6 +96,8 @@ class CategoryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -107,6 +111,8 @@ class CategoryDAO extends Model_pdo { if ($stm && $stm->execute ($values)) { return true; } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -152,6 +158,20 @@ class CategoryDAO extends Model_pdo { return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } + public function getDefault () { + $sql = 'SELECT * FROM category WHERE id="000000"'; + $stm = $this->bd->prepare ($sql); + + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $cat = HelperCategory::daoToCategory ($res); + + if (isset ($cat[0])) { + return $cat[0]; + } else { + return false; + } + } public function checkDefault () { $def_cat = $this->searchById ('000000'); |
