craue / CraueConfigBundle

Database-stored settings made available via a service for your Symfony project.
MIT License
173 stars 35 forks source link

"Using a custom entity for settings" doesn't work #43

Open Sentence opened 6 years ago

Sentence commented 6 years ago

Doctrine doesn't recognite the changes with Symfony 3.4.6, so cannot change the value's type to text, like described in here.

legumanP2T commented 3 years ago

In symfony 4.4 the only way I found was: parameters: craue_config.entity_name: App\Entity\MySetting

nor config: ... nor parameters: craue_config: entity_name: App\Entity\MySetting

And it still want to create the craue_config_setting default table…

krkxone commented 3 years ago

Create a file named 'craue_config.yaml' inside your "config/packages"-Folder. Insert this:

craue_config:
  entity_name: App\Entity\YOURENTITY

After that, create you entity like this:

<?php

namespace App\Entity;

use Craue\ConfigBundle\Entity\BaseSetting;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass="Craue\ConfigBundle\Repository\SettingRepository")
 * @ORM\Table(name="app_configuration")
 */
class Configuration extends BaseSetting
{
}

You also have to create a file like "craue.yaml" inside your "config\routes"-Folder.

craue_config_settings_modify:
  path: /admin/settings/configuration
  defaults:
    _controller: Craue\ConfigBundle\Controller\SettingsController::modifyAction