Problem/Motivation

quora.module includes a lot of helper functions. In D8, we can use them as services.

Proposed resolution

  1. Create Quora Services.
  2. Decouple form code from .module files.

Remaining tasks

  1. Create QuoraServices.php and move helper functions to it.
  2. File a separate issue for decoupling form code.

Comments

navneet0693 created an issue. See original summary.

navneet0693’s picture

Assigned: navneet0693 » Unassigned
Status: Active » Needs review
StatusFileSize
new19.41 KB

Please review :)

gg24’s picture

Assigned: Unassigned » navneet0693
Status: Needs review » Needs work

Hi @navneet0693,
I tried this patch. Got error saying

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "quora.services". in Drupal\Component\DependencyInjection\Container->get() (line 157 of /Users/sites/drupal8/core/lib/Drupal/Component/DependencyInjection/Container.php).

Please check.

Thanks!

navneet0693’s picture

Status: Needs work » Needs review
StatusFileSize
new2.2 KB
new8.52 KB
navneet0693’s picture

@gg24 The error probably came up due to constructor trying to retrieve configurations of Quora config form, which might didn't exist, as the form wasn't saved at first.

To avoid such errors by user in future. I have moved it out of constructor of services class. You can see the changes in interdiff.txt

Please rectify it now.

gg24’s picture

Assigned: navneet0693 » Unassigned
Status: Needs review » Reviewed & tested by the community

This patch works as expected.

  • gg24 committed b2dd8fe on 8.x-2.x authored by navneet0693
    Issue #2851026 by navneet0693, gg24: Clean up quora.module and create...
gg24’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch @navneet0693!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.