illchuk/zfc-user-simple-settings

A solid little "user settings" addition to your ZfcUser Doctrine entity; with configurable defaults.

v0.2 2017-11-12 02:16 UTC

This package is auto-updated.

Last update: 2024-04-08 10:55:22 UTC


README

Build Status

A solid little "user settings" addition to your ZfcUser Doctrine entity; with configurable defaults.

Installation

Install with composer require illchuk/zfc-user-simple-settings

Then include in your modules.config.php:

[..., 'ZfcUser', 'ZfcUserSimpleSettings', ...]

Finally, drop it into your User entity like the following:

class User extends ZfcEntityUser implements SettingsInterface {

    use SettingsTrait;
    // ...
}

Configuration

Configure the default values by installing the auto-config file.

Then add the lifecycle listener as follows:

    'doctrine' => [
        'eventmanager' => [
            'orm_default' => [
                'subscribers' => [
                    \ZfcUserSimpleSettings\Entity\Listener\SettingsLifecycle::class,
                ],
            ],
        ],
    ],

Bonus

This functionality can actually be applied to any Doctrine entity; ZfcUser isn't actually required.