Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dillchuk/zfcusersimplesettings

A solid little "user settings" addition to your ZfcUser Doctrine entity; with configurable defaults.
https://github.com/dillchuk/zfcusersimplesettings

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# ZfcUserSimpleSettings
[![Build Status](https://travis-ci.org/dillchuk/ZfcUserSimpleSettings.svg?branch=master)](https://travis-ci.org/dillchuk/ZfcUserSimpleSettings)

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](config/zfcusersimplesettings.global.php.dist).

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.