Extending ElggObject with a new class but save fails

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo} span.s1 {font-variant-ligatures: no-common-ligatures}

I've added a new class "Reflection":

class Reflection extends ElggObject {

It's registered in activate.php:

 

if (get_subtype_id('object', 'reflection')) {

update_subtype('object', 'reflection', 'Reflection');

} else {

add_subtype('object', 'reflection', 'Reflection');

}

 

But when I save it:

 

$reflection = new Reflection();

$reflection->subtype = 'reflection';

...

$reflection->save();

 

it fails:

 

Call to undefined method Reflection::save()

 

 

I'm new to PHP but the Object extension I'm doing seems standard.  Anyone know what's wrong?

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking