@param string $fieldName
@param array  $cache

@return void
776916
public function enableAssociationCache($fieldName, array $cache)
    {
        $this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults ($fieldName, $cache);
    }
1054654
private function convertCacheElementToCacheMetadata(
        SimpleXMLElement $cacheMapping,
        Mapping\ClassMetadata $metadata,
        $fieldName = null
    ) {
        $baseRegion    = strtolower(str_replace('\\', '_', $metadata->getRootClassName()));
        $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : '');

        $region = (string) ($cacheMapping['region'] ?? $defaultRegion);
        $usage  = isset($cacheMapping['usage'])
            ? constant(sprintf('%s::%s', Mapping\CacheUsage::class, strtoupper((string) $cacheMapping['usage'])))
            : Mapping\CacheUsage::READ_ONLY;

        return new Mapping\CacheMetadata($usage, $region);
    }
1224592
public static function getFieldKey($fieldName, $fieldId)
    {
        if (isset(get_field_objects($fieldId)[$fieldName]['key'])) {
            return get_field_objects($fieldId)[$fieldName]['key'];
        }

        return false;
    }
554151
private function mapFieldName($fieldName)
    {
        if (isset($this->fieldNameMapping[$fieldName])) {
            $fieldName = $this->fieldNameMapping[$fieldName];
        }

        return $fieldName;
    }
464566
public function delete($cache = null)
    {
        foreach ($this->getModels() as $model) {
            $model->delete($cache);
        }
    }
40579
public function remove($fieldName)
    {
        $key = array_search($fieldName, $this->fieldList);

        if ($key !== false) {
            unset($this->fieldList[$key]);
        }
    }
270465
public function fillFieldWithValue(string $fieldName, $value, ?string $containerName = null): void
    {
        $newContainerName = (!$containerName) ? $containerName : sprintf($this::NEW_FIELD_TITLE_PATTERN, EzFieldElement::getFieldInternalNameByName($containerName));
        $fieldElement = $this->getField($fieldName, $newContainerName);
        $fieldElement->setValue($value);
    }
1032438
public void addCache(String cacheName, AsyncLoadingCache cache) {
        children.put(cacheName, cache.synchronous());
    }
224866
public function deleteByField($fieldName, $keys)
    {
        $keys = (array)$keys;
        if (empty($keys)) {
            return;
        }
        //Filter relations so we don't delete records which this one only belongs to
        $relations = array_filter(
            $this->entity->getRelations(),
            function (Relation $relation) {
                return !$relation instanceof Relation\BelongsTo;
            }
        );
        if (empty($relations)) {
            $this->manager->postPendingQuery(
                new PendingQuery(
                    $this->entity,
                    PendingQuery::TYPE_DELETE,
                    $this->queryBuilder
                        ->delete($this->entity->getTable())
                        ->where($this->equalsExpression($fieldName, $keys)),
                    $this->parameters
                )
            );
        } else {
            $this->deleteRecords(
                $this->with(array_keys($relations))
                     ->getByField($fieldName, $keys)
            );
        }
    }
907256
function setCastedField($fieldName, $val) {
		$mapping = $this->editableFieldMapping();
		if (isset($mapping[$fieldName])) {
			$this->$fieldName = $val;
		}
	}
702571
private function createQuery($cache = false)
    {
        $q           = '';
        $i           = 0;
        $uniqueArray = [];

        foreach ($this->fields as $field) {
            if (in_array($field->identifier(), $uniqueArray)) {
                $q .= ',' . $field->table() . '.' . $field->identifier() . ' AS ' . $field->table() . ucfirst($field->identifier());
            } else {
                if ($i > 0) {
                    $q .= ',' . $field->table() . '.' . $field->identifier();
                } else {
                    $q .= 'SELECT ' . $field->table() . '.' . $field->identifier();
                }
            }

            $uniqueArray[] = $field->identifier();
            $i++;
        }

        $q .= ' FROM ' . $this->table();

        if (!$cache) {
            foreach ($this->getJoins() as $joinKey => $joinValue) {
                $q .= $joinValue;
            }
        }

        $this->setQuery($q);
    }
383328
public function setFromName($fieldName)
    {
        if (empty($this->name)) {
            $this->name = $fieldName;
        }
        $this->attrName = $this->getAttrName();
        $this->concrete = false === empty($this->getColumnName());

        if (empty($this->verboseName)) {
            $this->verboseName = ucwords(
                str_replace(
                    '_',
                    ' ',
                    $this->name
                )
            );
        }
    }
303352
public function removeFetchField($fieldName) {
    $flip = array_flip($this->fetches);
    unset($flip[$fieldName]);
    $this->fetches = array_flip($flip);
  }
516162
public static function setCacheDriver(Cache $cache = null, $namespace = null)
    {
        self::setCache(self::$cacheDriver, $cache, $namespace);
    }
228629
public function in ($fieldName, $fieldArray = [])
    {
        $fieldArray = array_map(function($v) { return sprintf('"%s"', $v); }, $fieldArray);
        $tableName  = '';

        if (strpos($fieldName, '.') === false) {
            $tableName = $this->table() . '.';
        }

        if (!empty($fieldArray)) {
            $this->setIn($tableName . $fieldName . ' IN (' . implode(', ', $fieldArray) . ')');
        }

        return $this;
    }
1029953
public function verifyNewFieldDefinitionFormExists(string $fieldName): void
    {
        $form = $this->context->getElementByText(sprintf($this::NEW_FIELD_TITLE_PATTERN, EzFieldElement::getFieldInternalNameByName($fieldName)), $this->fields['fieldDefinitionName']);
        if ($form === null) {
            throw new \Exception('Field definition not added to the form.');
        }
    }
94495
public function deleteField($fieldname) {

        $field = $this->getField($fieldname);
        if ($field) {
            $i = $this->findFieldInArray($fieldname);
            // Look for prev and next field
            $prevfield = $this->getField($field->getPrevious());
            $nextfield = $this->getField($field->getNext());
            // Change their previous and next attributes
            if ($prevfield) {
                $prevfield->setNext($field->getNext());
            }
            if ($nextfield) {
                $nextfield->setPrevious($field->getPrevious());
            }
            // Delete the field
            unset($this->fields[$i]);
            // Reorder the whole structure
            $this->orderFields($this->fields);
            // Recalculate the hash
            $this->calculateHash(true);
            // We have one deleted field, so the table has changed
            $this->setChanged(true);
        }
    }