public function getBlockTypesByFieldId($fieldId, $indexBy = null)
{
if (empty($this->_fetchedAllBlockTypesForFieldId[$fieldId])) {
$this->_blockTypesByFieldId[$fieldId] = [];
$results = $this->_createBlockTypeQuery()->where('fieldId = :fieldId', [':fieldId' => $fieldId])->queryAll();
foreach ($results as $result) {
$blockType = new Neo_BlockTypeModel($result);
$this->_blockTypesById[$blockType->id] = $blockType;
$this->_blockTypesByFieldId[$fieldId][] = $blockType;
}
$this->_fetchedAllBlockTypesForFieldId[$fieldId] = true;
}
if ($indexBy) {
return $this->_indexBy($this->_blockTypesByFieldId[$fieldId], $indexBy);
}
return $this->_blockTypesByFieldId[$fieldId];
}