mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-11 17:25:02 +00:00
activity: avoid existing entities being added in Users, ThirdParties, Persons
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user