Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Extending Object-Oriented PHP Inheritance Extending a Method

when i called my parent::setValue the description property return null.

public function setValues($data = []) { parent::setValues($data); if (isset($data['description'])) { $this->setStatus($data['description']); } }

object(ListingPremium)#3 (8) { ["description":"ListingPremium":private]=> NULL ["allowed_tags":protected]=> string(37) "

" ["status":protected]=> string(14) "My Description" ["id":"ListingBasic":private]=> NULL ["title":"ListingBasic":private]=> NULL ["website":"ListingBasic":private]=> NULL ["email":"ListingBasic":private]=> NULL ["twitter":"ListingBasic":private]=> NULL }

Alex Bauer
Alex Bauer
9,426 Points

It might be too late to answer this by now but I see that you didn't change $this->setStatus($data['description']); } to $this->setDescription($data['description']); }.

The status was already set using the call to the original method in parent::SetValues. Then, you add the additional description on top of that method.