craue / craueconfigbundle Goto Github PK
View Code? Open in Web Editor NEWDatabase-stored settings made available via a service for your Symfony project.
License: MIT License
Database-stored settings made available via a service for your Symfony project.
License: MIT License
Hello,
This bundle allows creating a custom entity for settings which makes it possible to override data type.
However, it does not seem possible to use more than one data type in an application using this bundle.
I would be very helpful if one was able to create several settings of different types (eg. setting1 => date, setting2 => string of 255 char, setting3 => text rendered in a textarea, etc.).
So it seems that instead of creating a custom entity, we would be looking at having a field containing the datatype of the parameter.
Regards,
I am not sure if maybe it is me doing something wrong but I have the DoctrineCacheBundleAdapter setup and so far it is working like a charm. However, what happens if in a very specific section I want the configuration bundle to fetch a configuration from the database ignoring the cache?
An example on this is that there is a value that I am constantly changing directly on the database to test something out but since the result is cached it is obviously not working properly.
Hi,
Great bundle and I am so glad to find it. I was wondering if it is possible to set the field type, for example if i want an option to display as a checkbox or dropdown menu how can i achieve it? I know the view to render the form is modify_form.html.twig
but the fields that are being rendered are all TextType
Hello,
I'm looking for a bit of help integrating a custom form schema. I'm trying to switch over from SyliusSettingsBundle to CraueConfigBundle because Sylius doesn't support Symfony4. The settings fields need to be displayed in a custom form that was integrated with the Sylius bundle using a service tag in services.yml
, like this:
emails_settings_schema:
class: AppBundle\Settings\EmailsSettingsSchema
tags:
- { name: "sylius.settings_schema", namespace: "emails" }
The schema was integrated using the findTaggedServices
function in the bundle. Could you tell me how I can integrate this schema using CraueConfigBundle?
When provider is tagged to be cleared during cache:clear command, container is failing to be assembled.
It appears, that assembling process messes up with arguments:
"Symfony\Component\Cache\Traits\RedisTrait::init()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "string" given.
With File cache adapter the same configuration works just fine.
craue_config_cache_provider:
class: Symfony\Component\Cache\Adapter\RedisAdapter
public: false
tags:
- { name: 'cache.pool', clearer: 'cache.system_clearer' }
arguments:
- '@Redis'
- 'craue_config'
- 3600
Hello, I'm a little newbie in Symfony 2, and I would like know, how I do access the config inside of twig template ?
The syntax for retrieving a setting should probably mirror that of ParameterBag - ie. ->get() rather than ->getSetting()
Hi,
Thanks for this great bundle.
I think it would be even more awesome if we could cache the results of the doctrine queries (using redis for example), and of course, invalidate when the value changes.
What do you think ?
-Julien
Is there a way to prevent the default craue_config_setting
table from being created when running a doctrine:migrations:diff
?
I can create a custom entity in my application by doing this: https://github.com/craue/CraueConfigBundle#using-a-custom-entity-for-settings
...however although it produces the config_setting
custom table, it also includes the craue_config_setting
table too - which I don't need.
$this->addSql('CREATE TABLE config_setting (name VARCHAR(255) NOT NULL, section VARCHAR(255) DEFAULT NULL, value TEXT DEFAULT NULL, comment VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name))');
$this->addSql('CREATE TABLE craue_config_setting (name VARCHAR(255) NOT NULL, section VARCHAR(255) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name))');
Hi,
The configuration for using DoctrineCacheBundle seem to be for an older version of Symfony, please can you explain how to implement this in a Symfony 4 project?
# in app/config/config.yml
parameters:
craue_config.cache_adapter.class: Craue\ConfigBundle\CacheAdapter\DoctrineCacheBundleAdapter
doctrine_cache:
providers:
craue_config_cache:
apc: ~
namespace: craue_config
aliases:
- craue_config_cache_provider
Doctrine doesn't recognite the changes with Symfony 3.4.6, so cannot change the value's type to text, like described in here.
As already discussed in #18 the Setting
entity mapping is coded using annotations, which makes it impossible to override it. So what I'd like to propose is to move from Annotations to a yml
file so the entity mapping can be overridden in /app/Resources/CraueConfigBundle
. That way the bundle doesn't change, but allows others to fix this.
I'm having issues with version 2.3.0 with PR #50
Installed this version and it broke my app. Getting the following error :
Class "Craue\ConfigBundle\Entity\Setting" sub class of "Craue\ConfigBundle\Entity\BaseSetting" is not a valid entity or mapped super class.
I had a custom Setting class, I had to shorten the name
to 191 chars for indexing (multibyte).
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
class Setting extends \Craue\ConfigBundle\Entity\Setting
{
/**
* @ORM\Id
* @ORM\Column(name="name", type="string", length=191, nullable=false, unique=true)
* @Assert\NotBlank()
*/
protected $name;
}
I did not have anything else in my config.yml or other code.
Checking the change and the readme, I changed my code to
use Craue\ConfigBundle\Entity\BaseSetting;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="Craue\ConfigBundle\Repository\SettingRepository")
* @ORM\Table(name="config_setting")
*/
class Setting extends BaseSetting
{
/**
* @ORM\Id
* @ORM\Column(name="name", type="string", length=191, nullable=false, unique=true)
* @Assert\NotBlank()
*/
protected $name;
}
and updated the config.yml to contain :
craue_config:
entity_name: Tamago\DefaultBundle\Entity\Setting
Then made a DoctrineMigration to rename the craue_config_setting
table to config_setting
But after all that, when getting a value, it returns null. I discovered the entity is not being hydrated correctly (value = null). Any changes to the value (setting a value) is not getting saved to the database.
Am I missing another setting somewhere ?
I understand the reasoning behind not making it 'easy' to create settings, since you shouldn't need to unless you're developing and have access to the code/db, but I think a console command to create settings would be a pretty good middle ground between a full ui (pointless) and busting out a SQL/database editor (or fiddling around with writing a good query in a migration).
The console command could also generate the doctrine migration to insert the new setting for you when you deploy.
Thoughts?
We are using dynamic database connections for multiple tenant databases but it seems the bundle is coupled to use the default entity manager only.
When running the migration script for the db, even when specifying the em, it fails due to
...has a dependency on a non-existent service "doctrine.orm.default_entity_manager".
I can't immediately see a config setting to override this
Hi,
I am trying to use this bundle but after following the step for the instalation when I want to retrieve a setting, an error is thrown at this line : $this->get('craue_config')->get('can_user_participate');
.
The full error I get :
Service "craue_config" not found: even though it exists in the app's container, the container inside "App\Controller\DefaultController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services. Try using dependency injection instead.
I am using Symfony 4.2
Thanks,
A.
Hello,
Is it possible to customize how settings are rendered? Specifically, I'd like to render some of the settings as plain text fields, while others as ckeditor fields. As far as I can tell, this is not possible because the settings are rendered as a collection of identical forms. Is this correct?
Thinking about using this for app-wide as well as per-user settings? Could per-user settings be achieved via the "section" functionality, or would that be fitting a square peg into a round hole?
Not an issue, just a feature request. How about:
$this->get('craue_config')->getSection('name-of-a-section')
which returns an array of all settings in that section?
Is it possible to insert system variables / names / in a dynamic way if settings table is empty ?
Now we can only to update their values.
I'm enabling caching using DoctrineCacheBundle
and a custom entity where settings are stored.
This entity is also being managed from a basic web backend with easy admin bundle.
When a config value is changed from the web interface, it still returns the old value when called from twig or controllers since it's kept getting cached. I have to manually flush it from the command line.
Why is this value not getting removed from the cache if updated within the app? Might I be missing something else in my setup?
Following the steps in the README.
Installed the package, loading the migration, updated routing.yaml, but I get the error:
There is no extension able to load the configuration for "craue_config_settings"
Hi. We have some strict table naming conventions on the project, and it would be great to add ability to specify a custom table name instead of craue_config_setting.
Tried update symfony from 6.4 to 7.1 and getting the following errors:
Problem 1
- craue/config-bundle 2.6.0 requires symfony/cache ~4.4|~5.3|^6 -> found symfony/cache[v4.4.0, ..., v4.4.48, v5.3.0, ..., v5.4.40, v6.0.0, ..., v6.4.8] but these were not loaded, likely because it conflicts with another require.
- craue/config-bundle 2.7.0 requires symfony/cache ~4.4|~5.4|^6.3 -> found symfony/cache[v4.4.0, ..., v4.4.48, v5.4.0, ..., v5.4.40, v6.3.0, ..., v6.4.8] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires craue/config-bundle ^2.6 -> satisfiable by craue/config-bundle[2.6.0, 2.7.0].
Any plans to support symfony 7?
Hi,
Great bundle, just a small issue when using Redis for caching.
The key for an element is not the same on update :
It looks like it's incrementing.
Any way to change this ?
Thanks in advance for your help,
Julien
This is a nice bundle which I would like to use in the Symfony 4 to which we are going to migrate our project. This package, though, requires 2 or 3 version of the Symfony. Any plans to support 4th version?
I am pretty weak at writings bundles so please don't suggest making a pull request
After setting up the bundle such commands as:
php app/console doctrine:migrations:diff
php app/console doctrine:migrations:migrate
php app/console doctrine:schema:update
doesn't recognize schema changes
Hi, thanks, this is a good bundle, however is "poor" in the sense that lacks some mandatory (IMHO) features like:
Have a look at https://github.com/dmishh/SettingsBundle, how about integrating some features here?
Hi
Congrats for the bundle.
I have a multy tenancy saas with many users and i want to manage settings by user and by instance.
What is the best practice you recommend for this scenario?
Moving the bundle to the src and modify or using as parent bundle? or what?
Tried update symfony to 5.0 and get errors:
Problem 1
- craue/config-bundle 2.1.0 requires symfony/framework-bundle ~2.7|~3.0|~4.0 -> satisfiable by symfony/framework-bundle[v4.1.1] but these conflict with your requirements or minimum-stability.
- craue/config-bundle 2.1.0 requires symfony/framework-bundle ~2.7|~3.0|~4.0 -> satisfiable by symfony/framework-bundle[v4.1.1] but these conflict with your requirements or minimum-stability.
- craue/config-bundle 2.1.0 requires symfony/framework-bundle ~2.7|~3.0|~4.0 -> satisfiable by symfony/framework-bundle[v4.1.1] but these conflict with your requirements or minimum-stability.
- Installation request for craue/config-bundle (locked at 2.1.0, required as ~2.1) -> satisfiable by craue/config-bundle[2.1.0].
Several things could be done to make testing easier:
It's good idea to add MongoDB support.
Hi there,
I try to upgrade from Symfony 6.2 to 6.3 and get the following logs:
Method "Symfony\Component\DependencyInjection\Extension\ExtensionInterface::load()" might add "void" as a native return type declaration in the future. Do the same in implementation "Craue\ConfigBundle\DependencyInjection\CraueConfigExtension" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()" might add "void" as a native return type declaration in the future. Do the same in implementation "Craue\ConfigBundle\DependencyInjection\CraueConfigExtension" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "Symfony\Component\Form\AbstractType::buildForm()" might add "void" as a native return type declaration in the future. Do the same in child class "Craue\ConfigBundle\Form\Type\SettingType" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "Symfony\Component\Form\AbstractType::finishView()" might add "void" as a native return type declaration in the future. Do the same in child class "Craue\ConfigBundle\Form\Type\SettingType" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "Symfony\Component\Form\AbstractType::configureOptions()" might add "void" as a native return type declaration in the future. Do the same in child class "Craue\ConfigBundle\Form\Type\SettingType" now to avoid errors or add an explicit @return annotation to suppress this message.
Any chance you can fix this?
Best regards
This would ensure that the requirements defined in the composer.json are fine.
It would be great if the bundle allows us to subscribe to some events - especially right before saving or updating a setting.
I need to validate some of the settings (f.e. to be only numeric). Sure, I can write my own controller and form, but this would be an easier way.
Hi. I'm trying to get the settings work into a symfony command that I created
The command extends from ContainerAwareCommand
.
I tried with
$this->getContainer()->getParameter('craue_config')->get('enterprise_ruc')
But doesn't works
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.