Welcome, Guest
Username: Password: Remember me

TOPIC: Warning: Attempt to assign property of non-object

Warning: Attempt to assign property of non-object 13 Jun 2016 12:55 #14046

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Hi Cooks,

I'm getting the "Warning: Attempt to assign property of non-object in" warning when I try and assign values to the $data in my model fork.

Does anyone have any clues?

I'm editing a fork to modify the function loadFormData() to setup some (complex) default values. (Complex meaning I'm looking up tables, applying logic, concatenate strings, etc).

It happens on a line like this...
$data->branch_id = 1;

Prior to that line I have the usual...
$data = parent::loadFormData();
... plus other usual code...
Just call me Chris :)
Last Edit: 13 Jun 2016 13:09 by organicwebs. Reason: making easier to read
The administrator has disabled public write access.

Warning: Attempt to assign property of non-object 13 Jun 2016 13:09 #14047

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
For other who may need to know, I found the problem.

$data was being returned as an array from the Parent . So to fix I used...
$data['branch_id'] = 1;
Instead of
$data->branch_id = 1;
Just call me Chris :)
The administrator has disabled public write access.
Time to create page: 0.085 seconds

Get Started