(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 (265.79 KiB) Viewed 641 times