Page 1 of 1

service.yml location - newbe question

Posted: Sat Jun 08, 2019 1:31 pm
by johnh530
In the tutorial for authentication at:
https://area51.phpbb.com/docs/dev/3.2.x ... ation.html

====
An authentication provider that comes with phpBB requires a minimum of two files: a class and an entry in a config/auth.yml file. Authentication providers that are part of an extension must provide their own YAML file defining the service in addition to all normal requirements of an extension.
====

The config directory on the distribution shows directories:
====
default installer production
====

It appears that production directory has links to default directory
The config.yml file in default directory has:
====
# phpBB's config file (This line is needed because of the packager)
====

There is also a container directory in default directory which has service.yml with a number of included service_...yml files.

Later in the tutorial is states:
====
For proper dependency injection the provider must be added to services.yml. The name of the
====

Questions:

Am I in the right area for the service.yml file I need to create?
Do I need to make any changes to config.yml?
The services.yml file I need to create - Do I create a file in config/default/container and include it in config/default/container/services.yml?

johnh...

Re: service.yml location - newbe question

Posted: Sun Jun 09, 2019 4:52 am
by rxu
You shouldn't change phpBB core files ever. That's about your extension's directory, so your custom config.yml has to be located in your extension's /config subdirectory (not in phpBB core), so you just create /config/config.yml file in your extension, then you add some services into it.

Re: service.yml location - newbe question

Posted: Tue Jun 11, 2019 4:28 am
by johnh530
Thanks for your reply - I found the skeleton extension and created an auth extension - enabled it - and it shows up on authentication lists in the general tab of the ACP.

I still am confused by the documentation and don't seem to be able to get into the constructor of the class.

In my post I quoted the documentation about needing to add an entry to config/auth.yml then later talks about services.yml. I mistakenly switched config/auth.yml to config/config.yml - my bad.

I think you are indicating I need create the config/auth.yml file and add some service to it.
I have a services.yml file following the tutorial.

When I enable the authentication extension and select it as the authentication on the General->Client Communication->Authentication I am unable to login and any logging even in the constructor of the class does not occur. I'm pretty sure the object is not being created.
I see no errors in the apache logs.

Questions:
1) if config/auth.yml needs to be created exactly what does it need to look like? - what is it's relation to the services.yml file?
2) If making a change to an extension - either php or yml - is a disable and re enabling enough to get the changes be effective?
3) If there is an issue with config - are there any logs which record this issue?

johnh...

Re: service.yml location - newbe question

Posted: Sun Jun 23, 2019 10:20 am
by ingo169
Hi, I have the exact same question - the tutorial seems inconsistent. Can anybody give us a hint on how to do it? Where should wich file with which name be placed?

Re: service.yml location - newbe question

Posted: Mon Jun 24, 2019 1:13 pm
by rxu
The only config file phpBB parses is config.yml. In common, you can simply put all of your services there.
Splitting services into several config files is being used just for better coding style and readability.
All config files other than config.yml in /config folder have to be imported into config.yml using imports operator.

if you're going to change config file (during extension development for example), you have to disable the extension, then apply changes, then enable extension.
If there're any issues with services, you will most likely find it out immediately as far as such kind of issues create PHP fatal errors.

Re: service.yml location - newbe question

Posted: Mon Jun 24, 2019 1:28 pm
by david63
rxu wrote:
Mon Jun 24, 2019 1:13 pm
if you're going to change config file (during extension development for example), you have to disable the extension, then apply changes, then enable extension.
Unless you are working in Development environment.

Re: service.yml location - newbe question

Posted: Mon Jun 24, 2019 8:46 pm
by 3Di
You can edit the .yaml file and simply purge the cache.
Doesn't matter which environment you are working in and no need of the disable/reenable steps.

Re: service.yml location - newbe question

Posted: Mon Jun 24, 2019 9:15 pm
by david63
3Di wrote:
Mon Jun 24, 2019 8:46 pm
You can edit the .yaml file and simply purge the cache.
Agreed - but in development environment you do not need to purge the cache, it does it for you.

Re: service.yml location - newbe question

Posted: Mon Jun 24, 2019 9:22 pm
by 3Di
Question of habits, I wanted to clarify this point.
I am used to delete the cache from my editor, no ACP: http://prntscr.com/o65k51