Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 430 Bytes

GroupPolicy.md

File metadata and controls

20 lines (14 loc) · 430 Bytes

GroupPolicy

<?php

use Chubbyphp\Deserialization\Denormalizer\DenormalizerContextInterface;
use Chubbyphp\Deserialization\Policy\GroupPolicy;
use MyProject\Model\Model;

$model = new Model();

/** @var DenormalizerContextInterface $context */
$context = ...;
$context = $context->withAttribute('groups', ['group1']);

$policy = new GroupPolicy(['group1']);

echo $policy->isCompliant('path', $model, $context);
// 1