Q - How to fix yaml file error in phpBB3 custom extension ?

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: Q - How to fix yaml file error in phpBB3 custom extension ?

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย Raja Pdl » 07/11/2024 9:09 am

fixed this bug by changing

in "config/routing.yml"

โค้ด: เลือกทั้งหมด

mindphp_m_example_controller:
    path:  /m_example/{action}
    defaults: {  _controller:  mindphp.m_example.controller:base , action: '' }  
in "services.yml"

โค้ด: เลือกทั้งหมด

services: 
    mindphp.m_example.controller:
        class: mindphp\m_example\controller\main
        arguments:
            - '@auth'
            - '@config'
            - "@dbal.conn"
            - '@controller.helper'
            - '@language'
            - '@pagination'
            - '@request'
            - '@template'
            - '@user'
            - '%core.root_path%'
            - '%core.php_ext%'  
            - "%core.table_prefix%"    
            - "@service_container"
   
    mindphp.m_example.listener:
        class: mindphp\m_example\event\listener
        arguments:
            - "@controller.helper"
            - "@template"
            - "@config"
            - "@user"
            - "@dbal.conn"
            - "@request"
            - "%core.php_ext%"
            - "%core.root_path%"
            - "%core.table_prefix%"          
            
        tags:
            - { name: event.listener }   

in "controller/main.php"

โค้ด: เลือกทั้งหมด

<?php
namespace mindphp\m_example\controller;

class main
{
    protected $config;
    protected $cache;
    protected $db;
    protected $template;
    protected $user;
    protected $helper;
    protected $phpbb_container;
    protected $request;
    protected $auth;
    protected $table_prefix;

    public function __construct(\phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, Container $phpbb_container, \phpbb\request\request $request, \phpbb\auth\auth $auth, $table_prefix) {
        $this->config = $config;
        $this->cache = $cache;
        $this->db = $db;
        $this->template = $template;
        $this->user = $user;
        $this->helper = $helper;
        $this->phpbb_container = $phpbb_container;
        $this->request = $request;
        $this->auth = $auth;
        $this->table_prefix = $table_prefix;
    }

    public function base()
    {
        
    }
}
Thank you.

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย Raja Pdl » 05/11/2024 3:26 pm

eange08 เขียน: 05/11/2024 1:36 pm Based on the properties you've decided to use in the controller, we can adjust the `services.yml` and the `controller` to align with this setup:

### `services.yml`

In `services.yml`, specify only the `arguments` that match the properties in the controller's constructor, removing any unnecessary arguments:

```yaml

โค้ด: เลือกทั้งหมด

services:
  mindphp.m_example.controller:
    class: mindphp\m_example\controller\main
    arguments:
      - '@config'
      - '@cache'
      - '@dbal.conn'
      - '@template'
      - '@user'
      - '@controller.helper'
      - '@service_container'
      - '@request'
      - '@auth'
      - '%core.table_prefix%'

### `controller/main.php`

Update the controller to use only the needed properties:

```php

โค้ด: เลือกทั้งหมด

<?php
namespace mindphp\m_example\controller;

class main
{
    protected $config;
    protected $cache;
    protected $db;
    protected $template;
    protected $user;
    protected $helper;
    protected $phpbb_container;
    protected $request;
    protected $auth;
    protected $table_prefix;

    public function __construct(\phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, Container $phpbb_container, \phpbb\request\request $request, \phpbb\auth\auth $auth, $table_prefix) {
        $this->config = $config;
        $this->cache = $cache;
        $this->db = $db;
        $this->template = $template;
        $this->user = $user;
        $this->helper = $helper;
        $this->phpbb_container = $phpbb_container;
        $this->request = $request;
        $this->auth = $auth;
        $this->table_prefix = $table_prefix;
    }

    public function handle()
    {
        // Assign a greeting to the template for testing
        $this->template->assign_vars([
            'GREETING' => 'Hello from m_example!',
        ]);

        return $this->helper->render('m_example_template.html');
    }
}

### Summary

- **`services.yml`**: Only include the arguments specified in the constructor.
- **`controller/main.php`**: Keep only the properties that are actively used.
I don't understand it clearly. How is this related to "routing.yml" file ?
Whatever I changed in services.yml and controller/main.php, the error of routing.yml remains the same .
How is it related ?

โค้ด: เลือกทั้งหมด

m_example_main:
path: /m_example_main
defaults: 
  _controller: mindphp.m_example.controller:handle
Error is

โค้ด: เลือกทั้งหมด

Fatal error: Uncaught InvalidArgumentException: The definition of "m_example_main" in "C:\xampp\htdocs\phpbb_3\ext/mindphp/m_example/config/routing.yml" must be a YAML array. in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php:203 Stack trace: #0 C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php(88): Symfony\Component\Routing\Loader\YamlFileLoader->validate(NULL, 'm_example_main', 'C:\\xampp\\htdocs...') #1 C:\xampp\htdocs\phpbb_3\vendor\symfony\config\Loader\DelegatingLoader.php(40): Symfony\Component\Routing\Loader\YamlFileLoader->load('ext/mindphp/m_e...', 'yaml') #2 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(116): Symfony\Component\Config\Loader\DelegatingLoader->load('ext/mindphp/m_e...', 'yaml') #3 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(261): phpbb\routing\router->get_routes() #4 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(246): phpbb\routing\router->create_dumped_url_generator() #5 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(168): phpbb\routing\router->get_generator() #6 C:\xampp\htdocs\phpbb_3\phpbb\routing\helper.php(148): phpbb\routing\router->generate('phpbb_ucp_forgo...', Array, 1) #7 C:\xampp\htdocs\phpbb_3\phpbb\controller\helper.php(212): phpbb\routing\helper->route('phpbb_ucp_forgo...', Array, true, false, 1) #8 C:\xampp\htdocs\phpbb_3\index.php(226): phpbb\controller\helper->route('phpbb_ucp_forgo...') #9 {main} thrown in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php on line 203

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย eange08 » 05/11/2024 1:36 pm

Based on the properties you've decided to use in the controller, we can adjust the `services.yml` and the `controller` to align with this setup:

### `services.yml`

In `services.yml`, specify only the `arguments` that match the properties in the controller's constructor, removing any unnecessary arguments:

```yaml

โค้ด: เลือกทั้งหมด

services:
  mindphp.m_example.controller:
    class: mindphp\m_example\controller\main
    arguments:
      - '@config'
      - '@cache'
      - '@dbal.conn'
      - '@template'
      - '@user'
      - '@controller.helper'
      - '@service_container'
      - '@request'
      - '@auth'
      - '%core.table_prefix%'

### `controller/main.php`

Update the controller to use only the needed properties:

```php

โค้ด: เลือกทั้งหมด

<?php
namespace mindphp\m_example\controller;

class main
{
    protected $config;
    protected $cache;
    protected $db;
    protected $template;
    protected $user;
    protected $helper;
    protected $phpbb_container;
    protected $request;
    protected $auth;
    protected $table_prefix;

    public function __construct(\phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, Container $phpbb_container, \phpbb\request\request $request, \phpbb\auth\auth $auth, $table_prefix) {
        $this->config = $config;
        $this->cache = $cache;
        $this->db = $db;
        $this->template = $template;
        $this->user = $user;
        $this->helper = $helper;
        $this->phpbb_container = $phpbb_container;
        $this->request = $request;
        $this->auth = $auth;
        $this->table_prefix = $table_prefix;
    }

    public function handle()
    {
        // Assign a greeting to the template for testing
        $this->template->assign_vars([
            'GREETING' => 'Hello from m_example!',
        ]);

        return $this->helper->render('m_example_template.html');
    }
}

### Summary

- **`services.yml`**: Only include the arguments specified in the constructor.
- **`controller/main.php`**: Keep only the properties that are actively used.

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย Raja Pdl » 05/11/2024 1:08 pm

eange08 เขียน: 05/11/2024 12:11 pm Here's the response in English:

The `services.yml` file and the PHP file you provided seem correct in terms of YAML structure and PHP class setup. However, the YAML error may be due to incorrect indentation or formatting issues in the `services.yml` file. To avoid the error, try the following adjustments:

1. **Correct `services.yml` Formatting:** Ensure proper YAML syntax with the following structure:

```yaml

โค้ด: เลือกทั้งหมด

  services:
       mindphp.m_example.controller:
           class: mindphp\m_example\controller\main
           arguments:
               - '@config'
               - '@controller.helper'
               - '@language'
               - '@template'

2. **Spacing and Indentation:**
- Make sure `services:` starts at the beginning of the line without any spaces in front.
- Use 4 spaces for indentation under `mindphp.m_example.controller` to correctly define the `class` and `arguments`.

3. **Clear the Cache:** After making these adjustments, clear the phpBB cache by going to `ACP > General > Purge the cache`. Alternatively, navigate to the `cache` folder in phpBB and delete all files except for `.htaccess` to force phpBB to reload the updated files.

4. **Check File Structure:** Verify that your folder and file structure are correct:
- `ext/mindphp/m_example/config/services.yml`
- `ext/mindphp/m_example/controller/main.php`

5. **Test Again:** After clearing the cache and verifying the structure, try enabling the extension once more to see if the issue is resolved.

By following these steps, the error displaying for services.yml has removed

โค้ด: เลือกทั้งหมด

services:
 mindphp.m_example.controller:
     class: mindphp\m_example\controller\main
     arguments:
         - '@config'
         - '@controller.helper'
         - '@language'
         - '@template'

But the error for routing.yml is not solved

โค้ด: เลือกทั้งหมด

m_example_main:
path: /m_example_main
defaults: 
  _controller: mindphp.m_example.controller:handle
it displays the same error

โค้ด: เลือกทั้งหมด

Fatal error: Uncaught InvalidArgumentException: The definition of "m_example_main" in "C:\xampp\htdocs\phpbb_3\ext/mindphp/m_example/config/routing.yml" must be a YAML array. in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php:203 Stack trace: #0 C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php(88): Symfony\Component\Routing\Loader\YamlFileLoader->validate(NULL, 'm_example_main', 'C:\\xampp\\htdocs...') #1 C:\xampp\htdocs\phpbb_3\vendor\symfony\config\Loader\DelegatingLoader.php(40): Symfony\Component\Routing\Loader\YamlFileLoader->load('ext/mindphp/m_e...', 'yaml') #2 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(116): Symfony\Component\Config\Loader\DelegatingLoader->load('ext/mindphp/m_e...', 'yaml') #3 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(261): phpbb\routing\router->get_routes() #4 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(246): phpbb\routing\router->create_dumped_url_generator() #5 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(168): phpbb\routing\router->get_generator() #6 C:\xampp\htdocs\phpbb_3\phpbb\routing\helper.php(148): phpbb\routing\router->generate('phpbb_help_faq_...', Array, 1) #7 C:\xampp\htdocs\phpbb_3\phpbb\controller\helper.php(212): phpbb\routing\helper->route('phpbb_help_faq_...', Array, true, false, 1) #8 C:\xampp\htdocs\phpbb_3\includes\functions.php(4050): phpbb\controller\helper->route('phpbb_help_faq_...') #9 C:\xampp\htdocs\phpbb_3\aboutus.php(10): page_header('Title Here') #10 {main} thrown in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php on line 203

mindphp/m_example/controller/main.php

โค้ด: เลือกทั้งหมด

<?php
namespace mindphp\m_example\controller;

class main
{
    public function handle()
    {
        return 'Hello from m_example!';
    }
}

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย eange08 » 05/11/2024 12:11 pm

Here's the response in English:

The `services.yml` file and the PHP file you provided seem correct in terms of YAML structure and PHP class setup. However, the YAML error may be due to incorrect indentation or formatting issues in the `services.yml` file. To avoid the error, try the following adjustments:

1. **Correct `services.yml` Formatting:** Ensure proper YAML syntax with the following structure:

```yaml

โค้ด: เลือกทั้งหมด

  services:
       mindphp.m_example.controller:
           class: mindphp\m_example\controller\main
           arguments:
               - '@config'
               - '@controller.helper'
               - '@language'
               - '@template'

2. **Spacing and Indentation:**
- Make sure `services:` starts at the beginning of the line without any spaces in front.
- Use 4 spaces for indentation under `mindphp.m_example.controller` to correctly define the `class` and `arguments`.

3. **Clear the Cache:** After making these adjustments, clear the phpBB cache by going to `ACP > General > Purge the cache`. Alternatively, navigate to the `cache` folder in phpBB and delete all files except for `.htaccess` to force phpBB to reload the updated files.

4. **Check File Structure:** Verify that your folder and file structure are correct:
- `ext/mindphp/m_example/config/services.yml`
- `ext/mindphp/m_example/controller/main.php`

5. **Test Again:** After clearing the cache and verifying the structure, try enabling the extension once more to see if the issue is resolved.

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย Raja Pdl » 05/11/2024 11:32 am

(1) Error Message is

โค้ด: เลือกทั้งหมด

Fatal error: Uncaught InvalidArgumentException: The definition of "m_example_main" in "C:\xampp\htdocs\phpbb_3\ext/mindphp/m_example/config/routing.yml" must be a YAML array. in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php:203 Stack trace: #0 C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php(88): Symfony\Component\Routing\Loader\YamlFileLoader->validate(NULL, 'm_example_main', 'C:\\xampp\\htdocs...') #1 C:\xampp\htdocs\phpbb_3\vendor\symfony\config\Loader\DelegatingLoader.php(40): Symfony\Component\Routing\Loader\YamlFileLoader->load('ext/mindphp/m_e...', 'yaml') #2 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(116): Symfony\Component\Config\Loader\DelegatingLoader->load('ext/mindphp/m_e...', 'yaml') #3 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(261): phpbb\routing\router->get_routes() #4 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(246): phpbb\routing\router->create_dumped_url_generator() #5 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(168): phpbb\routing\router->get_generator() #6 C:\xampp\htdocs\phpbb_3\phpbb\routing\helper.php(148): phpbb\routing\router->generate('phpbb_help_faq_...', Array, 1) #7 C:\xampp\htdocs\phpbb_3\phpbb\controller\helper.php(212): phpbb\routing\helper->route('phpbb_help_faq_...', Array, true, false, 1) #8 C:\xampp\htdocs\phpbb_3\includes\functions.php(4050): phpbb\controller\helper->route('phpbb_help_faq_...') #9 C:\xampp\htdocs\phpbb_3\aboutus.php(10): page_header('Title Here') #10 {main} thrown in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php on line 203

(2)The controller file "mindphp/m_example/controller/main.php" file doesn't include "main_controller" method,
it includes only handle() method

โค้ด: เลือกทั้งหมด

<?php
namespace mindphp\m_example\controller;

class main
{
    public function handle()
    {
        return 'Hello from m_example!';
    }
}
So, I changed method name to "handle" in routing.yml,

โค้ด: เลือกทั้งหมด

m_example_main:
path: /m_example_main
defaults: 
  _controller: mindphp.m_example.controller:handle
But it displays the same error

โค้ด: เลือกทั้งหมด

Fatal error: Uncaught InvalidArgumentException: The definition of "m_example_main" in "C:\xampp\htdocs\phpbb_3\ext/mindphp/m_example/config/routing.yml" must be a YAML array. in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php:203 Stack trace: #0 C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php(88): Symfony\Component\Routing\Loader\YamlFileLoader->validate(NULL, 'm_example_main', 'C:\\xampp\\htdocs...') #1 C:\xampp\htdocs\phpbb_3\vendor\symfony\config\Loader\DelegatingLoader.php(40): Symfony\Component\Routing\Loader\YamlFileLoader->load('ext/mindphp/m_e...', 'yaml') #2 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(116): Symfony\Component\Config\Loader\DelegatingLoader->load('ext/mindphp/m_e...', 'yaml') #3 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(261): phpbb\routing\router->get_routes() #4 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(246): phpbb\routing\router->create_dumped_url_generator() #5 C:\xampp\htdocs\phpbb_3\phpbb\routing\router.php(168): phpbb\routing\router->get_generator() #6 C:\xampp\htdocs\phpbb_3\phpbb\routing\helper.php(148): phpbb\routing\router->generate('phpbb_help_faq_...', Array, 1) #7 C:\xampp\htdocs\phpbb_3\phpbb\controller\helper.php(212): phpbb\routing\helper->route('phpbb_help_faq_...', Array, true, false, 1) #8 C:\xampp\htdocs\phpbb_3\includes\functions.php(4050): phpbb\controller\helper->route('phpbb_help_faq_...') #9 C:\xampp\htdocs\phpbb_3\aboutus.php(10): page_header('Title Here') #10 {main} thrown in C:\xampp\htdocs\phpbb_3\vendor\symfony\routing\Loader\YamlFileLoader.php on line 203

(3) When I generate extension, services.yml file is empty

When I add the following codes in services.yml

โค้ด: เลือกทั้งหมด

 services:
     mindphp.m_example.controller:
         class: mindphp\m_example\controller\main 
         arguments:
             - '@config'
             - '@controller.helper'
             - '@language'
             - '@template'
 ```
it displays the following error

โค้ด: เลือกทั้งหมด

phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit phpBB.com for support.


Exception: The file "C:\xampp\htdocs\phpbb_3\ext\mindphp\m_example\config\services.yml" does not contain valid YAML: Unable to parse in "C:\\xampp\\htdocs\\phpbb_3\\ext\\mindphp\\m_example\\config\\services.yml" at line 1 (near " services:").

#0 C:\xampp\htdocs\phpbb_3\vendor\symfony\dependency-injection\Loader\YamlFileLoader.php(117): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->loadFile('C:\\xampp\\htdocs...')
#1 C:\xampp\htdocs\phpbb_3\phpbb\extension\di\extension_base.php(99): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load('services.yml')
#2 C:\xampp\htdocs\phpbb_3\phpbb\extension\di\extension_base.php(63): phpbb\extension\di\extension_base->load_services(Object(Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder))
#3 C:\xampp\htdocs\phpbb_3\vendor\symfony\dependency-injection\Compiler\MergeExtensionConfigurationPass.php(71): phpbb\extension\di\extension_base->load(Array, Object(Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder))
#4 C:\xampp\htdocs\phpbb_3\vendor\symfony\http-kernel\DependencyInjection\MergeExtensionConfigurationPass.php(39): Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#5 C:\xampp\htdocs\phpbb_3\vendor\symfony\dependency-injection\Compiler\Compiler.php(140): Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#6 C:\xampp\htdocs\phpbb_3\vendor\symfony\dependency-injection\ContainerBuilder.php(789): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#7 C:\xampp\htdocs\phpbb_3\phpbb\di\container_builder.php(223): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#8 C:\xampp\htdocs\phpbb_3\common.php(115): phpbb\di\container_builder->get_container()
#9 C:\xampp\htdocs\phpbb_3\adm\index.php(23): require('C:\\xampp\\htdocs...')
#10 {main}
Screenshot (2175).png
Screenshot (2175).png (265.79 KiB) Viewed 3077 times

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย eange08 » 05/11/2024 9:51 am

It seems your information is too limited. Here's a checklist to troubleshoot:

1. **What error message appears?**
2. **Check the controller file**: Does it contain a method named `main_controller`?
3. **Verify the services file**: Make sure it correctly references the controller path.

Sample setup for `services`:
```yaml

โค้ด: เลือกทั้งหมด

   
   services:
       mindphp.m_example.controller:
           class: mindphp\m_example\controller\main  # Ensure this matches the controller file name
           arguments:
               - '@config'
               - '@controller.helper'
               - '@language'
               - '@template'
   ```
Confirm each point to help locate any misconfiguration.

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย Raja Pdl » 04/11/2024 6:46 pm

I changed the codes as following and diabled and enabled again, clear the cache, but it displays the same error

โค้ด: เลือกทั้งหมด

m_example_main:
path: /m_example_main
defaults: 
  _controller: mindphp.m_example.controller:main_controller
I also tested like
from this structure link - https://area51.phpbb.com/docs/dev/maste ... ml#routing

โค้ด: เลือกทั้งหมด

m_example_main:
path: /m_example_main
defaults: { _controller:mindphp.m_example.controller:handle }
But it displays the same error
What can I do now ?

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย eange08 » 04/11/2024 4:31 pm

You can check the structure of each file in the phpBB extension at: https://area51.phpbb.com/docs/dev/maste ... ml#routing


It's recommended that the path name should match the controller name, for example:

โค้ด: เลือกทั้งหมด

m_example_main:
  path: /m_example_main
  defaults: 
    _controller: mindphp.m_example.controller:main_controller
This helps maintain consistency and makes it easier to understand the file structure.

Re: Q - How to fix yaml file error in phpBB3 custom extension ?

โดย eange08 » 04/11/2024 4:31 pm

You can check the structure of each file in the phpBB extension at: https://area51.phpbb.com/docs/dev/maste ... ml#routing


It's recommended that the path name should match the controller name, for example:

โค้ด: เลือกทั้งหมด

m_example_main:
  path: /m_example_main
  defaults: 
    _controller: mindphp.m_example.controller:main_controller
This helps maintain consistency and makes it easier to understand the file structure.

ข้างบน