Skip to:

Opened 8 years ago

Closed 7 years ago

#7333 closed defect (bug) (maybelater)

Make it easier for developers to add data to core classes

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Core Keywords: 2nd-opinion


See #7290. Our move to split queries has made it more difficult than it already was to modify core objects.

One idea is to fire an action at the end of each object's populate() method:

do_action( 'bp_groups_group_populate', $this );

This change may have weird repercussions as we move toward improved OOP for BP objects. For example, our inline documentation will no longer be a reliable guarantee of the properties available on an object. But perhaps there are technical limitations we could put in place (like black-box magic methods) that would help us to work around this, while still allowing developers to modify defined properties on the fly.

To reiterate, I don't think it's critical that we allow developers to add new properties to these objects, as is being requested in #7290. In that case, it'd be just as easy for plugins to stash their stuff elsewhere for use in the loop. But there are definitely legitimate use cases for modifying existing properties.

Does anyone have thoughts about this?

Change History (3)

#1 @DJPaul
7 years ago

I'm not really convinced that allowing extra properties to be set on objects, presumably to store extra data, is a good architectural model, or reliable long-term solution. I assume this could happen because our APIs make it too hard to pass extra data between certain things, and I'd rather we improve those as we find them.

#2 @DJPaul
7 years ago

  • Milestone changed from Awaiting Review to Under Consideration

Pinging again for more opinions. I don't mind adding actions if we think it's a good idea but I don't want to make it people to use our objects as a place to store their junk.

#3 @DJPaul
7 years ago

  • Milestone Under Consideration deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Given the lack of enthusiasm, let's close this for now.

Note: See TracTickets for help on using tickets.