Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1445 from tomaszdurka/issue-1445
Browse files Browse the repository at this point in the history
Delete languageKey only if exists
  • Loading branch information
tomaszdurka committed Oct 29, 2014
2 parents dc4ef70 + c98e96d commit ec53c23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/CM/Model/LanguageKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ public static function exists($name) {
*/
public static function deleteByName($name) {
$languageKey = self::findByName($name);
$languageKey->delete();
if ($languageKey) {
$languageKey->delete();
}
}

public static function getPersistenceClass() {
Expand Down
1 change: 1 addition & 0 deletions tests/library/CM/Model/LanguageKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function testDeleteByName() {
$this->assertTrue(CM_Model_LanguageKey::exists('foo'));
CM_Model_LanguageKey::deleteByName('foo');
$this->assertFalse(CM_Model_LanguageKey::exists('foo'));
CM_Model_LanguageKey::deleteByName('foo');
}

public function testIncreaseUpdateCountNewDeploy() {
Expand Down

0 comments on commit ec53c23

Please sign in to comment.