This commit is contained in:
William DURAND 2012-02-06 00:17:29 +01:00
parent 007de8c265
commit 80682ba3c9

View File

@ -156,7 +156,7 @@ class ModelChoiceList extends ObjectChoiceList
public function getChoicesForValues(array $values) public function getChoicesForValues(array $values)
{ {
if (!$this->loaded) { if (!$this->loaded) {
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
return $this->query->create()->filterBy(current($this->identifier), $values)->findOne(); return $this->query->create()->filterBy(current($this->identifier), $values)->findOne();
} }
@ -182,7 +182,7 @@ class ModelChoiceList extends ObjectChoiceList
// know that the IDs are used as values // know that the IDs are used as values
// Attention: This optimization does not check choices for existence // Attention: This optimization does not check choices for existence
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
$values = array(); $values = array();
foreach ($models as $model) { foreach ($models as $model) {
@ -217,7 +217,7 @@ class ModelChoiceList extends ObjectChoiceList
// know that the IDs are used as indices // know that the IDs are used as indices
// Attention: This optimization does not check choices for existence // Attention: This optimization does not check choices for existence
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
$indices = array(); $indices = array();
foreach ($models as $model) { foreach ($models as $model) {
@ -252,7 +252,7 @@ class ModelChoiceList extends ObjectChoiceList
// know that the IDs are used as indices and values // know that the IDs are used as indices and values
// Attention: This optimization does not check values for existence // Attention: This optimization does not check values for existence
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
return $this->fixIndices($values); return $this->fixIndices($values);
} }
@ -276,7 +276,7 @@ class ModelChoiceList extends ObjectChoiceList
*/ */
protected function createIndex($model) protected function createIndex($model)
{ {
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
return current($this->getIdentifierValues($model)); return current($this->getIdentifierValues($model));
} }
@ -296,7 +296,7 @@ class ModelChoiceList extends ObjectChoiceList
*/ */
protected function createValue($model) protected function createValue($model)
{ {
if (count($this->identifier) === 1) { if (1 === count($this->identifier)) {
return current($this->getIdentifierValues($model)); return current($this->getIdentifierValues($model));
} }