mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix some psalm errors
This commit is contained in:
@@ -11,10 +11,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Validator\Constraints\Relationship;
|
||||
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||
{
|
||||
@@ -25,14 +27,18 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||
$this->relationshipRepository = $relationshipRepository;
|
||||
}
|
||||
|
||||
public function validate($relationship, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (!$constraint instanceof RelationshipNoDuplicate) {
|
||||
throw new UnexpectedTypeException($constraint, RelationshipNoDuplicate::class);
|
||||
}
|
||||
|
||||
$fromPerson = $relationship->getFromPerson();
|
||||
$toPerson = $relationship->getToPerson();
|
||||
if (!$value instanceof Relationship) {
|
||||
throw new UnexpectedValueException($value, Relationship::class);
|
||||
}
|
||||
|
||||
$fromPerson = $value->getFromPerson();
|
||||
$toPerson = $value->getToPerson();
|
||||
|
||||
$relationships = $this->relationshipRepository->findBy([
|
||||
'fromPerson' => [$fromPerson, $toPerson],
|
||||
|
Reference in New Issue
Block a user