We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to store users in accounts\username folder.
accounts\username
In my config\system.yaml:
config\system.yaml
accounts: type: flex storage: folder avatar: gravatar
I copied system/blueprints/flex/user-accounts.yaml to user/blueprints/flex/user-accounts.yaml. Data configuration part:
system/blueprints/flex/user-accounts.yaml
user/blueprints/flex/user-accounts.yaml
# Data Configuration data: object: 'Grav\Common\Flex\Types\Users\UserObject' collection: 'Grav\Common\Flex\Types\Users\UserCollection' index: 'Grav\Common\Flex\Types\Users\UserIndex' storage: class: 'Grav\Common\Flex\Types\Users\Storage\UserFolderStorage' options: formatter: class: 'Grav\Framework\File\Formatter\YamlFormatter' folder: 'account://' pattern: '{FOLDER}/{KEY}{EXT}' indexed: true key: username case_sensitive: false
All should be fine but users are saved to hashed folders:
As you can see with Xdebug, pattern and storage_key are wrong (not from our storage configuration):
pattern
storage_key
storage
Ok. I can extend UserObject to my custom to override save() func:
UserObject
save()
<?php declare(strict_types=1); namespace Grav\Plugin\SoglFlex\Flex\Types\Users; use Grav\Common\Grav; use Grav\Common\Flex\Types\Users\UserObject as DefaultUserObject; class UserObject extends DefaultUserObject { /** * {@inheritdoc} * @see FlexObjectInterface::save() */ public function save() { if (!$this->exists()) { $this->setStorageKey($this->getProperty('username')); } parent::save(); } }
Much better but still triple nesting:
BUT when I try to override class: 'Grav\Plugin\SoglFlex\Flex\Types\Users\UserFolderStorage' it just not fire.
class: 'Grav\Plugin\SoglFlex\Flex\Types\Users\UserFolderStorage'
It looks as if the entire storage section is not being read, but the default values are being used.
@mahagr How to fix?
The text was updated successfully, but these errors were encountered:
After hours of debugging I found that if I write in config\system.yaml:
accounts: type: flex storage: SOMETHING avatar: gravatar
My custom class works fine and also all other storage options from user-accounts.yaml.
user-accounts.yaml
However, each time of Configuration saving (in Admin panel) storage: SOMETHING will be overwritten. Need to add +1 value for custom or something else:
storage: SOMETHING
Sorry, something went wrong.
No branches or pull requests
I want to store users in
accounts\username
folder.In my
config\system.yaml
:I copied
system/blueprints/flex/user-accounts.yaml
touser/blueprints/flex/user-accounts.yaml
. Data configuration part:All should be fine but users are saved to hashed folders:
As you can see with Xdebug,
pattern
andstorage_key
are wrong (not from ourstorage
configuration):Ok. I can extend
UserObject
to my custom to overridesave()
func:Much better but still triple nesting:
BUT when I try to override
class: 'Grav\Plugin\SoglFlex\Flex\Types\Users\UserFolderStorage'
it just not fire.It looks as if the entire
storage
section is not being read, but the default values are being used.@mahagr How to fix?
The text was updated successfully, but these errors were encountered: