Entity/Person.php
public function isAccompanyingPeriodValid(ExecutionContextInterface $context)
    {
        $r = $this->checkAccompanyingPeriodsAreNotCollapsing();
        
        if ($r !== true) {
            if ($r['result'] === self::ERROR_PERIODS_ARE_COLLAPSING) {
                $context->addViolationAt('accompanyingPeriods',
                    'Two accompanying periods have days in commun',
                    array());
            }
            
            if ($r['result'] === self::ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD) {
                $context->addViolationAt('accompanyingPeriods',
                    'A period is opened and a period is added after it',
                    array());
            }
        }
    }
public function isAccompanyingPeriodValid(ExecutionContextInterface $context)
    {
        $r = $this->checkAccompanyingPeriodsAreNotCollapsing();
        
        if ($r !== true) {
            if ($r['result'] === self::ERROR_PERIODS_ARE_COLLAPSING) {
                $context->addViolationAt('accompanyingPeriods',
                    'Two accompanying periods have days in commun',
                    array());
            }
            
            if ($r['result'] === self::ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD) {
                $context->addViolationAt('accompanyingPeriods',
                    'A period is opened and a period is added after it',
                    array());
            }
        }
    }
Validation callback that checks if the accompanying periods are valid

This method add violation errors.