symfony - Why am I seeing CheckMX deprecated warning?

I am seeing the following warning in symfony's profiler:
User Deprecated: The "checkMX" option is deprecated since Symfony 4.2.
I would like to know how to get rid of the warning, thanks.
I am not clear where this is coming from? In the trace it points to the following code in one of my repositories.
/**
* @return Ride[] Returns an array of Ride objects
*/
public function findRidesByYear($year)
{
return $this->createQueryBuilder('r')
->andWhere('r.date >= :year')
->setParameter('year', $year)
->orderBy('r.date', 'ASC')
->getQuery()
->getResult()
;
}
Specifically it is highlighting the getResult() function as shown in the screenshot:
Answer
Solution:
This a deprecation that was introduced in Symfony 4.2 on the@Assert\Email
validation, which you are probably using. See: https://symfony.com/doc/current/reference/constraints/Email.html#checkmx
The reason for the deprecation are given in the docs:
This option is not reliable because it depends on the network conditions and some valid servers refuse to respond to those requests.
You can fix the deprecation by removing the option from the assertion usage, e.g. in your entities. Instead you can use thestrict
option that uses a different libraryegulias/email-validator
to perform a strict validation for the email address.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: undefined array key php
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.