public function count() {
$numberOfElements = NULL;
if ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
- $this->initializeStorage();
- $numberOfElements = count($this->storage);
- // FIXME Count on comma separated lists does not respect hidden objects
-// if (isset($parentKeyFieldName)) {
-// $numberOfElements = $this->fieldValue;
-// } else {
-// if (empty($this->fieldValue)) {
-// $numberOfElements = 0;
-// }
-// $numberOfElements = count(explode(',', $this->fieldValue));
-// }
+ $parentKeyFieldName = $this->columnMap->getParentKeyFieldName();
+ if (!empty($parentKeyFieldName)) {
+ $numberOfElements = $this->fieldValue;
+ } else {
+ $this->initializeStorage();
+ $numberOfElements = count($this->storage);
+ // FIXME Count on comma separated lists does not respect hidden objects
+ // if (empty($this->fieldValue)) {
+ // $numberOfElements = 0;
+ // }
+ // $numberOfElements = count(explode(',', $this->fieldValue));
+ }
} elseif ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
$numberOfElements = $this->fieldValue;
} else {