Created
August 4, 2011 20:52
-
-
Save gergoerdosi/1126247 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/code/libraries/koowa/model/state.php b/code/libraries/koowa/model/state.php | |
index aa037e5..56264f6 100644 | |
--- a/code/libraries/koowa/model/state.php | |
+++ b/code/libraries/koowa/model/state.php | |
@@ -182,14 +182,14 @@ class KModelState extends KModelAbstract | |
if($unique) | |
{ | |
//Unique values cannot be null or an empty string | |
- if($state->unique && (!empty($state->value) || is_numeric($state->value))) | |
+ if($state->unique && (!empty($state->value) || is_numeric($state->value) || !(is_array($state->value) && count($state->value) > 1))) | |
{ | |
$result = true; | |
//Check related states to see if they are set | |
foreach($state->required as $required) | |
{ | |
- if(empty($this->_state[$required]->value) && !is_numeric($state->value)) | |
+ if(empty($this->_state[$required]->value) && !is_numeric($this->_state[$required]->value)) | |
{ | |
$result = false; | |
break; | |
@@ -221,27 +221,8 @@ class KModelState extends KModelAbstract | |
*/ | |
public function isUnique() | |
{ | |
- $unique = false; | |
- | |
- //Get the unique states | |
$states = $this->getData(true); | |
- | |
- if(!empty($states)) | |
- { | |
- $unique = true; | |
- | |
- //If a state contains multiple values the state is not unique | |
- foreach($states as $state) | |
- { | |
- if(is_array($state) && count($state) > 1) | |
- { | |
- $unique = false; | |
- break; | |
- } | |
- } | |
- } | |
- | |
- return $unique; | |
+ return !empty($states); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment