I'm using Symfony 2.3
I have a function that lets me send email notifications when pressed. It sends email and everything, but when I want to retrieve an id from the database to send it as part of the subject of the email, it doesn't work.
private function updateForm($data)
{
$repository = $this->getDoctrine()->getRepository('MainBundle:Unity');
$attached = $repository->find('unityid');
$message = \Swift_Message::newInstance()
->setSubject($attached)
->setFrom('some@email')
->setTo('some@email')
->setBody($attached);
$this->get('mailer')->send($message);
return true;
}
I do not know why I cannot retrieve the ID. I'm doing exactly like the Symfony documentation says.
What am I missing?
find()method finds an entity by its primary key / identifier.'unityid'looks like it's probably a column name rather than a primary key value.