Fehlende Dateien von letztem Commit
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3290 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
3a28866cd2
commit
c1adfdb967
2 changed files with 75 additions and 0 deletions
21
trunk/src/AppBundle/Validator/Constraints/BookingRequest.php
Normal file
21
trunk/src/AppBundle/Validator/Constraints/BookingRequest.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/13/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Validator\Constraints;
|
||||
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class BookingRequest extends Constraint
|
||||
{
|
||||
public function getTargets()
|
||||
{
|
||||
return self::CLASS_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?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')->
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue