Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 420 Bytes

GroupPolicy.md

File metadata and controls

20 lines (14 loc) · 420 Bytes

GroupPolicy

<?php

use Chubbyphp\Serialization\Normalizer\NormalizerContextInterface;
use Chubbyphp\Serialization\Policy\GroupPolicy;
use MyProject\Model\Model;

$model = new Model();

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

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

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