Simple Demo repo
Is there a demo repo for this bundle? I'd love to see it in action, without having to create the Settings classes and such. Thanks.
+1
Hi @tacman . I will create a demonstration bundle for you and link it here. This is really a cool project, and I only got to find out about it only recently.
Hi @tacman @jbtronics , I have created a demo repo that you can use for a "real world" Symfony 7 example application.
- https://github.com/gmurambadoro/jbtronics-blogging-demo
Let me know if this is helpful.
Regards, Gavin.
Thanks! Very helpful.
Any reason not to use php 8.3? I wanted to run it with sqlite (instead of doing the whole docker install), but I don't have sqlite installed on php8.2.
Once I made those changes, the installation instructions become really easy, after cloning
echo 'DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"' > .env.local
composer install
bin/console doctrine:schema:update --force --complete
bin/console d:fixtures:load -n
symfony server:start -d
symfony open:local
I can make a PR if you'd like.
Also, Symfony 7.1 is coming out in a few days, so I tweaked the composer file to allow it.
One thing that would really help is to make the pagination setting specific to the user.
That is, the admin might want 25, and the 'user' only 15 per page.
Only the admin should be able to change the global settings.
It's not clear how to make the pagination a user-specific setting, that is, part of the User class.
Of course, what I'm trying to avoid is adding a "pageLength" property to my user record, and instead use this bundle.
Thx.
Hi @tacman
There is no reason not to use PHP 8.3, it should work with any of the supported PHP versions for Symfony 7. You may send a pull request through since I think SQLite would simplify the code as well.
At the moment it appears that settings are global, and user-specific settings are not possible. @jbtronics may give us clarity.
- https://github.com/rvanlaak/SettingsBundle/blob/HEAD//Resources/doc/general-usage.md
Regards, Gavin.
Thanks @gmurambadoro . I did not have the time to look into your demo yet, but I certainly will.
And yes, for the moment this bundle only allows for global settings. I hope to extend it to allow users to override global settings for themselves and so on, but this will probably require also some changes in usage (as you somehow have to tell for which user to retrieve the settings).
@gmurambadoro Maybe a few suggestions to improve it:
The dependencyInjectable on the settings class attribute is redundant, as its true by default. The option is currently only there to disable this dependency injection for certain settings class.
Also, I would recommend to use dependency injection of settings instances over getting them from the entity manager, whenever possible. That makes type derivation easier and decouples your code from the SettingsManager, making it easier for testing.
That will probably not work for user related settings (as you somehow have to bring in the connection to a certain user in there), but this case will probably require some changes to the code anyway.
In a real world application, you should probably configure the storageAdapters via the central config file, but I guess for a demo, its good to demonstrate the ability to specify it on a per class base.
Also if somebody is interested, I am currently in the process of using this bundle for another project of mine, Part-DB, which was more or less the reason why I created this bundle.
You can find the settings definitions here: https://github.com/Part-DB/Part-DB-server/tree/settings-bundle/src/Settings It heavily utilizes the splitting up settings into small functional units and then embedding it into a larger treee of settings via settings embedds.
With the right template, this allows for the easy creation of complex structured settings forms, completly alone from the infos from the attributes:
just FYI, this bundle, and the demo app, now work with PHP 8.4, as https://github.com/ergebnis/classy just released version 1.7 with php8.4 support.