Eno\Fieldset ยป enforceAllElements

enforceAllElements()
enforceAllElements($enforce)

Set the default for all following queries on this fieldset of whether the presence of elements in the eno input text should be enforced (by default it is not). This can be used to prevent "template decay" - with presence enforcement enabled entries may be empty, but they (at least their declaration) must be there in the eno document and consequently they can not disappear from a template at any point without triggering an error.

enoconversions:
0001 = 1
0010 = 2
php$document = Parser::parse($input);

$conversions = $document->fieldset('conversions');

$conversions->enforceAllElements();

$conversions->entry('0011');  // throws a ValidationError
$conversions->entry('0011', [ 'enforce_element' => false ]);  // returns null

Parameters

$enforce

An optional boolean indicating whether to enforce or not. (otherwise true is assumed)