activity: avoid existing entities being added in Users, ThirdParties, Persons

This commit is contained in:
juminet
2021-11-29 12:27:54 +00:00
committed by Julien Fastré
parent 58119b3de0
commit b300858bdd
18 changed files with 277 additions and 94 deletions

View File

@@ -0,0 +1,42 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
*/
class ActivityValidity extends Constraint
{
public const IS_REQUIRED_MESSAGE = ' is required';
public const ROOT_MESSAGE = 'For this type of activity, ';
public $noPersonsMessage = 'For this type of activity, you must add at least one person';
public $noThirdPartiesMessage = 'For this type of activity, you must add at least one third party';
public $noUsersMessage = 'For this type of activity, you must add at least one user';
public $socialActionsMessage = 'For this type of activity, you must add at least one social action';
public $socialIssuesMessage = 'For this type of activity, you must add at least one social issue';
public function getTargets()
{
return self::CLASS_CONSTRAINT;
}
public function makeIsRequiredMessage(string $property)
{
return self::ROOT_MESSAGE . $property . self::IS_REQUIRED_MESSAGE;
}
}