Integrating phpbb to symfony4 website (Undefined class constant 'self::SCOPE_CONTAINER)

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
dariusmik
Registered User
Posts: 2
Joined: Fri Aug 10, 2018 9:04 am

Integrating phpbb to symfony4 website (Undefined class constant 'self::SCOPE_CONTAINER)

Post by dariusmik » Fri Aug 10, 2018 9:37 am

Our situation:
phpbb sits on: domain.com/forum
domain.com: project with "legacy" framework. When user logins/registers an account in domain.com, we copy this user's info into phpbb and login to both - domain.com and domain.com/forum

Now we are migrating our legacy project to symfony4 and our integration with forum does not work anymore. We are getting an error:
Error: Undefined class constant 'self::SCOPE_CONTAINER'

It seems that container from domain.com is not working with container from phpbb.
Is there a way to fix this without completely changing the way we integrate phpbb into our project?

When we needed to do some actions with phpbb in our domain.com we simply:

define('IN_PHPBB', true);
global $phpbb_container;
global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log;
global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
global $phpEx, $phpbb_root_path;
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Do some action. But now the error apears: Error: Undefined class constant 'self::SCOPE_CONTAINER'

I would appreaciate your ideas.

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24717
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Integrating phpbb to symfony4 website (Undefined class constant 'self::SCOPE_CONTAINER)

Post by Paul » Fri Aug 10, 2018 9:41 am

You probarbly won't be able to include it like that as phpBB already uses symfony (And more specific, symfony 2.8), so you will have major conflicts by including phpBB files when using symfony.

Instead of duplicating the login details I suggest you write a auth plugin that uses your database to authentication the users instead.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

dariusmik
Registered User
Posts: 2
Joined: Fri Aug 10, 2018 9:04 am

Re: Integrating phpbb to symfony4 website (Undefined class constant 'self::SCOPE_CONTAINER)

Post by dariusmik » Fri Aug 10, 2018 10:28 am

Thanks,
This is the answer that I was afraid I may get : )

It should be possible to use the same session for authentication in both domain.com and phpbb. So, it is not the biggest problem.
I still need to find a way to synchronize users between domain.com and phpbb.

So basically there is no way to reach phpbb container/classes from domain.com symfony4?

Other option probably would be to create some sort of API in forum, which would accept requests for updating/creating/deleting users.

User avatar
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 24717
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Integrating phpbb to symfony4 website (Undefined class constant 'self::SCOPE_CONTAINER)

Post by Paul » Fri Aug 10, 2018 10:34 am

I don't think so, as it symfony 2.8 will conflict with symfony 4.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 19 guests