Closed (fixed)
Project:
Spaces
Version:
6.x-3.6
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2012 at 19:24 UTC
Updated:
13 Dec 2012 at 22:07 UTC
Jump to comment: Most recent file
Comments
Comment #1
pdrake commentedHere's a patch which delays node_load until it is required and provides the og_private property without requiring a full node_load. This pattern could be extended to provide other properties via a direct query as well if other opportunities for performance improvements are identified.
Comment #2
glennpratt commentedInteresting idea, I've done the same for debugging and refactoring, but for performance is a pretty cool idea.
To be even more seamless, should probably implement the other common magic methods
__isset()__unset()and extend
stdClass.Not sure if there is a way to handle things like print_r, cast to array, serialize, etc, but that might be OK.
Comment #3
pdrake commentedI have taken your suggestions and implemented them. Certainly, the injected group object could be used in ways that are unintended, with side-effects, but I believe that the magic methods implemented cover all of the existing ways in which spaces itself is using the group object.
Comment #4
pdrake commentedAh, missed a function comment in that last patch. This patch is functionally the same, only adding the missing comment.
Comment #5
glennpratt commentedCould probably be
Comment #6
pdrake commentedBased on the suggestion in #5.
Comment #7
travist commentedIf it isn't loaded, and the first property it asks for is $node->og_private, this would probably fatal since $this->node would still be null at this point. I think you should at least pre-define $this->node to be a new stdClass() to avoid this.
Comment #8
travist commentedDisregard ^.... Didn't see you initialized it in the constructor.
Comment #9
pdrake commentedThis resolves a bug introduced in an earlier patch and PHP notices when accessing non-existent $node properties.
Comment #10
pdrake commentedTo help address contrib/custom code that may regard $space->group as a full node object, I have reworked the __get magic method definition a bit.
Comment #11
pdrake commentedThis is now available as a stand-alone module, complementing spaces_og: http://drupal.org/project/spaces_og_accelerated