git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3290 f459cee4-fb09-11de-96c3-f9c5f16c3c76
54 lines
No EOL
1.6 KiB
PHP
54 lines
No EOL
1.6 KiB
PHP
<?php
|
|
/**
|
|
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
|
* @date 12/16/2016
|
|
*/
|
|
|
|
namespace AppBundle\Validator\Constraints;
|
|
|
|
use AppBundle\Entity\BookingRequest;
|
|
use AppBundle\Entity\TravelDate;
|
|
use AppBundle\Entity\TravelProgram;
|
|
use AppBundle\Form\BookingRequestType;
|
|
use Symfony\Component\Validator\Constraint;
|
|
use Symfony\Component\Validator\ConstraintValidator;
|
|
|
|
/**
|
|
* Class BookingRequestValidator
|
|
* @package AppBundle\Validator
|
|
*/
|
|
class BookingRequestValidator extends ConstraintValidator
|
|
{
|
|
/*
|
|
private $travelDate;
|
|
private $travelProgram;
|
|
|
|
public function __construct(TravelDate $travelDate, TravelProgram $travelProgram)
|
|
{
|
|
$this->travelDate = $travelDate;
|
|
$this->travelProgram = $travelProgram;
|
|
}
|
|
*/
|
|
|
|
/**
|
|
* Checks if the passed value is valid.
|
|
*
|
|
* @param BookingRequest $bookingRequest The value that should be validated
|
|
* @param Constraint $constraint The constraint for the validation
|
|
*/
|
|
public function validate($bookingRequest, Constraint $constraint)
|
|
{
|
|
//die($bookingRequest->get);
|
|
for ($i = 0; $i < $bookingRequest->getTravelerCount(); ++$i)
|
|
{
|
|
//$this->context->atPa
|
|
$this->context->getValidator()->inContext($this->context)
|
|
->atPath('travelers['. $i .']')
|
|
->validate($bookingRequest->getTravelers()[$i])
|
|
;
|
|
//$this->context->getValidator()->validate($bookingRequest->getTravelers()[$i]);
|
|
}
|
|
//$this->context->getValidator()->startContext()
|
|
//->atPath('travelers')->
|
|
}
|
|
} |