-1

I looked around to see what this problem could be but I don't find anything similar.

Error:

Call to a member function persist() on null

The exception points me to this line

        $this->repository->getEntityManager()->persist($data);

In my repository i call the entitity mananger like so

    public function getEntityManager()
    {
    parent::getEntityManager();
    }

Why does the exception get thrown ? I'm very confused about this.

MewTwo
  • 465
  • 4
  • 14

1 Answers1

0

In my repository i call the entitity mananger like so

public function getEntityManager()
{
    parent::getEntityManager();
}

Try return parent::getEntityManager();

 public function getEntityManager()
 {
     return parent::getEntityManager();
 }
waterloomatt
  • 3,662
  • 1
  • 19
  • 25