// Fix test on primary key in Collection
This commit is contained in:
+11
-4
@@ -415,7 +415,7 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain some informations on a field (alias, name, type, etc.)
|
* Obtain some information on a field (alias, name, type, etc.)
|
||||||
*
|
*
|
||||||
* @param string $field Field name
|
* @param string $field Field name
|
||||||
* @return array
|
* @return array
|
||||||
@@ -433,14 +433,21 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fieldname = $split[$i];
|
$fieldname = $split[$i];
|
||||||
if (!isset($definition['fields'][$fieldname]))
|
if ($fieldname == $definition['primary'])
|
||||||
throw new PrestashopException('Field '.$fieldname.' not found in class '.$this->classname);
|
$type = ObjectMode::TYPE_INT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!isset($definition['fields'][$fieldname]))
|
||||||
|
throw new PrestashopException('Field '.$fieldname.' not found in class '.$this->classname);
|
||||||
|
|
||||||
|
$type = $definition['fields'][$fieldname]['type'];
|
||||||
|
}
|
||||||
|
|
||||||
$this->fields[$field] = array(
|
$this->fields[$field] = array(
|
||||||
'name' => $fieldname,
|
'name' => $fieldname,
|
||||||
'association' => $association,
|
'association' => $association,
|
||||||
'alias' => $this->generateAlias($association),
|
'alias' => $this->generateAlias($association),
|
||||||
'type' => $definition['fields'][$fieldname]['type'],
|
'type' => $type,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $this->fields[$field];
|
return $this->fields[$field];
|
||||||
|
|||||||
Reference in New Issue
Block a user