Bolt\Storage\FieldManager::get PHP Method

get() public method

Gets the field instance for the supplied class.
public get ( $class, $mapping ) : mixed
$class
$mapping
return mixed
    public function get($class, $mapping)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }
        if (array_key_exists($class, $this->handlers)) {
            $handler = $this->handlers[$class];
            $field = call_user_func_array($handler, [$mapping, $this->em]);
        } else {
            $field = new $class($mapping, $this->em);
        }
        if ($field instanceof SanitiserAwareInterface) {
            $field->setSanitiser($this->sanitiser);
        }
        return $field;
    }