从Symfony2中的数据库中获取字段

My entity class is like

class myData{
    private $id;
    private $dob;

    public function getId()
    {
        return $this->id;
    }

    public function setDob($dob)
    {
        $this->dob = new \DateTime($dob);
        return $this;
    }

    public function getDob()
    {
        return $this->dob;
    }
}

and in my controller file I am accessing the data like below:

public function outputAction(){
    $request = $this->get('request');
    $formid = $request->query->get('formid');
    $formData = $em->getRepository('acmedemoBundle:myData')->findById($formid);
}

I need to access the Dob field here. Please suggest how to access.

I am using Symfony 2.4

$formData = $em->getRepository('acmedemoBundle:myData')->findOneById($formid);
$formData->getDob()

Or

$formData = $em->getRepository('acmedemoBundle:myData')->findById($formid);
$formData[0]->getDob()

given you print_r of the $formData I would say try

$formData[0]->getDob();