Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

symfony annotations access to another field

$
0
0

I wanna have a start date and end date field in the database, but start date cant be greater than end date (logically) but is there any way to use Entity to make a comparison (with Assert/Constraints) or I have to do it elsewhere(and where)

in this example I use

/**
 * @ORM\Column(type="date")
 * @Assert\GreaterThanOrEqual("today")
 */
private $start_date;

/**
 * @ORM\Column(type="date")
 */
private $end_date;

is it possible at $end date to have @Assert\GreaterThan($start_date) somehow

can I access that or I need to have some custom function for that kind of check, and what is best practice to create that kind of check in Symfony


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>