Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acting upon group type creation #187

Merged
merged 45 commits into from
Jul 23, 2016
Merged

Acting upon group type creation #187

merged 45 commits into from
Jul 23, 2016

Conversation

RoySegall
Copy link
Collaborator

@RoySegall
Copy link
Collaborator Author

I need help from the bug guns @damiankloip @pfrenssen @chx - How can I inject a service into the group manager service?

After I'm creating a new group I want to invoke a module(or should this need to be an event dispatching?) but I can't user the \Drupal::moduleHandler() and I get an error that the cotainer did not intialized yet. When I tried to inject it through the services.yml I and empty value in the second argument.

What i'm missing here?

@chx
Copy link
Collaborator

chx commented Apr 24, 2016

That is very odd. Did you do a drush cr? Can we chat on something that's not github? PM me on IRC.

@RoySegall
Copy link
Collaborator Author

@chx I did use drush cr and we even get this on Travis when we have a clean installation. I'm online for the next 40 minutes or so.

@amitaibu
Copy link
Owner

amitaibu commented May 2, 2016

@RoySegall what's left here?

@RoySegall
Copy link
Collaborator Author

I want to have a second look on this one and extend testing.

@amitaibu
Copy link
Owner

amitaibu commented May 2, 2016

👍

@@ -44,6 +45,62 @@ function og_entity_insert(EntityInterface $entity) {
}

/**
* Implements hook_og_group_created().
*/
function og_og_group_created($entity_type, $bundle) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some documentation on why this hook is implemented and what is being done here? That will be helpful for people that are not familiar with this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we implement our own hook? Wouldn't it be better to handle this in GroupManager::addGroup()? This just adds unnecessary overhead of passing the data to a new function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem to me much more easy to pass this logic into a hook rather keep the code in the group manager. I'll try something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I still keeping the hook invocation.

*
* @see og_og_group_created()
*/
function hook_og_group_created($entity_type, $bundle) {
Copy link
Collaborator Author

@RoySegall RoySegall May 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfrenssen ^^

What do yo think?

@RoySegall
Copy link
Collaborator Author

@amitaibu I'm waiting for a couple of comments from our comrades but this is ready for review.

@RoySegall RoySegall changed the title WIP: Acting upon group type creation. Acting upon group type creation. May 8, 2016
@@ -459,6 +470,12 @@ protected function refreshGroupRelationMap() {

foreach ($this->entityTypeBundleInfo->getAllBundleInfo() as $group_content_entity_type_id => $bundles) {
foreach ($bundles as $group_content_bundle_id => $bundle_info) {

if ($group_content_bundle_id == 'user') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've seen we might have multiple user bundles, so probably this needs a better check.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good idea, as in Og8 we indeed no longer treat a user as group content. A user is a special case.

/cc @pfrenssen

@amitaibu
Copy link
Owner

I've added a few comments, but in general looks good. Thanks.

@RoySegall
Copy link
Collaborator Author

A re roll is needed and improving the test.

@RoySegall
Copy link
Collaborator Author

@amitaibu I added another bundle for the user for testing.

Ready for review.

@RoySegall
Copy link
Collaborator Author

@amitaibu I fixed another conflicts issues. Ready for review and merge.

* The created group.
*/
public function createUserGroupAudienceField(GroupCreationEventInterface $event)
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to line above.

* Mocked method calls when system under test should attach OG audience field
* on the user.
*/
protected function expectGroupCreation() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs its own method. You can move the code back to above method.

@amitaibu
Copy link
Owner

Minor comment, after that I'll merge.

@RoySegall
Copy link
Collaborator Author

@amitaibu I changed the location.

@amitaibu amitaibu merged commit ce3c61c into 8.x-1.x Jul 23, 2016
@amitaibu
Copy link
Owner

Thanks.

@amitaibu amitaibu deleted the 174 branch July 23, 2016 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants