public function getGroupsByFieldId($fieldId, $indexBy = null)
{
if (empty($this->_fetchedAllGroupsForFieldId[$fieldId])) {
$this->_groupsByFieldId[$fieldId] = [];
$results = $this->_createGroupQuery()->where('fieldId = :fieldId', [':fieldId' => $fieldId])->queryAll();
foreach ($results as $result) {
$group = new Neo_GroupModel($result);
$this->_groupsById[$group->id] = $group;
$this->_groupsByFieldId[$fieldId][] = $group;
}
$this->_fetchedAllGroupsForFieldId[$fieldId] = true;
}
if ($indexBy) {
return $this->_indexBy($this->_groupsByFieldId[$fieldId], $indexBy);
}
return $this->_groupsByFieldId[$fieldId];
}