I need to create a script to periodically send emails to some users. I have thought in creating a function in the controller and a path in the routing and in the cron job call www.mydomain.com/send for example.
But i don't think that is the best way to do it because whatever user could call the script.. What is the correct way to do so?
class UserController extends Controller{
public function sendAction(){
$em = $this->getDoctrine()->getEntityManager();
...
}
}