-5

I have a error saying that,

Fatal error: Call to a member function getId() on null on line 63

but how can i check the element, here is my code

54 public function edit($id) {
55  $form_group = $this->dm->find(Form_Group::class, $id);
56  if (empty($form_group)) {
57      $this->app->flash('error', 'Invalid record selected.');
58      $this->app->redirect($this->app->urlFor('form-group-list'));
59      die;
60  }
61
62  $record_company = $form_group->getCompany();
63  $enabled_modules = Common_Helper::get_enabled_modules($record_company->getId());

1 Answers1

-3

The problem is in this line:

$record_company = $form_group->getCompany(); // it returns null

You have to var_dump the $form_group variable and check content to be sure.
But as I can see, the form group doesn't have a company.

Gothiquo
  • 841
  • 1
  • 8
  • 31