CRUDlex\ServiceProvider::createDefinition PHP Method

createDefinition() protected method

Creates and setups an EntityDefinition instance.
protected createDefinition ( Pimple\Container $app, array $locales, array $crud, string $name ) : EntityDefinition
$app Pimple\Container the application container
$locales array the available locales
$crud array the parsed YAML of a CRUD entity
$name string the name of the entity
return EntityDefinition the EntityDefinition good to go
    protected function createDefinition(Container $app, array $locales, array $crud, $name)
    {
        $label = array_key_exists('label', $crud) ? $crud['label'] : $name;
        $localeLabels = $this->getLocaleLabels($locales, $crud);
        $standardFieldLabels = ['id' => $app['translator']->trans('crudlex.label.id'), 'created_at' => $app['translator']->trans('crudlex.label.created_at'), 'updated_at' => $app['translator']->trans('crudlex.label.updated_at')];
        $factory = $app->offsetExists('crud.entitydefinitionfactory') ? $app['crud.entitydefinitionfactory'] : new EntityDefinitionFactory();
        $definition = $factory->createEntityDefinition($crud['table'], $crud['fields'], $label, $localeLabels, $standardFieldLabels, $this);
        $this->configureDefinition($definition, $crud);
        return $definition;
    }