Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 736 Bytes

define-allowed-properties.md

File metadata and controls

49 lines (40 loc) · 736 Bytes

Define allowed properties

Class definition

You must define all allowed properties

public static function allowed()
{
    return [
        'property_name',
    ];
}

so then, you can define your value with the syntax:

YourValue::box([
    'property_name' => 'value',
]);

Configurator class

use Sensorario\Resources\Configurator;
use Sensorario\Resources\Container;
use Sensorario\Resources\Resource;

$configurator = new Configurator(
  'foo',
  new Container(
    'resources' => [
      'foo' => [
        'constraints' => [
          'allowed' => [
            'property_name',
          ],
        ],
      ],
    ]
  )
);

Resource::box([
  'property_name' => '42',
], $configurator);