Skip to content

Commit db69a4e

Browse files
authored
Merge pull request #1927 from OpenConext/upgrade-84
Merge maintenance work into main
2 parents f65e574 + f74bc7d commit db69a4e

129 files changed

Lines changed: 2374 additions & 2410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"ext-openssl": "*",
2424
"ext-pdo": "*",
2525
"beberlei/assert": "^3.3.3",
26-
"composer/package-versions-deprecated": "^1.11.99.5",
27-
"doctrine/dbal": "^3.10.3",
26+
"composer/package-versions-deprecated": "^1.11",
27+
"doctrine/dbal": "^4.3.3",
2828
"doctrine/doctrine-bundle": "^2.13.3",
2929
"doctrine/doctrine-migrations-bundle": "^3.6.0",
3030
"doctrine/orm": "^3.5.7",

composer.lock

Lines changed: 24 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/packages/doctrine.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ doctrine:
2323
engineblock_collab_person_uuid: OpenConext\EngineBlockBundle\Doctrine\Type\CollabPersonUuidType
2424
engineblock_metadata_coins: OpenConext\EngineBlockBundle\Doctrine\Type\MetadataCoinType
2525
engineblock_metadata_mdui: OpenConext\EngineBlockBundle\Doctrine\Type\MetadataMduiType
26+
27+
array: OpenConext\EngineBlockBundle\Doctrine\Type\SerializedArrayType
28+
object: OpenConext\EngineBlockBundle\Doctrine\Type\SerializedObjectType
29+
2630
orm:
2731
auto_generate_proxy_classes: "%kernel.debug%"
2832
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'

config/services/services.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ services:
22
_defaults:
33
public: true
44

5+
OpenConext\EngineBlockBundle\Bridge\EngineBlockBootstrapper:
6+
autowire: true
7+
autoconfigure: true
8+
tags:
9+
- { name: kernel.event_subscriber }
10+
511
OpenConext\EngineBlock\Xml\:
612
resource: '../../src/OpenConext/EngineBlock/Xml'
713
exclude: '../../src/OpenConext/EngineBlock/Xml/ValueObjects'

library/EngineBlock/Application/DiContainer.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@
3030
use OpenConext\EngineBlockBundle\Sbs\SbsClientInterface;
3131
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
3232
use Symfony\Component\Mailer\MailerInterface;
33-
use Twig\Environment;
3433

34+
/**
35+
* This DiContainer relies on fetching services from the Symfony service container. This is no longer the way to go.
36+
* Instead, going forward, inject new dependencies into \OpenConext\EngineBlockBundle\Bridge\DiContainerRuntime
37+
* This way we no longer need to worry about Symfony purging services and Symfony can properly optimize it's service container.
38+
*/
3539
class EngineBlock_Application_DiContainer extends \Pimple\Container
3640
{
3741
const ATTRIBUTE_METADATA = 'attributeMetadata';
@@ -417,14 +421,6 @@ public function getEncryptionKeysConfiguration()
417421
return $this->container->getParameter('encryption_keys');
418422
}
419423

420-
/**
421-
* @return Environment
422-
*/
423-
public function getTwigEnvironment()
424-
{
425-
return $this->container->get('twig');
426-
}
427-
428424
/**
429425
* @return array
430426
*/

library/EngineBlock/ApplicationSingleton.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
*/
1818

1919
use OpenConext\EngineBlock\Logger\Handler\FingersCrossed\ManualOrDecoratedActivationStrategy;
20-
use OpenConext\EngineBlock\Metadata\Entity\IdentityProvider;
2120
use OpenConext\EngineBlock\Metadata\MetadataRepository\EntityNotFoundException;
2221
use OpenConext\EngineBlock\Request\RequestId;
22+
use OpenConext\EngineBlockBundle\Bridge\DiContainerRuntime;
2323
use OpenConext\EngineBlockBundle\Exception\Art;
2424
use Psr\Log\LoggerInterface;
25-
use SAML2\XML\saml\Issuer;
2625
use Symfony\Component\DependencyInjection\ContainerInterface;
2726

2827
define('ENGINEBLOCK_FOLDER_ROOT' , realpath(__DIR__ . '/../../') . '/');
@@ -80,6 +79,8 @@ class EngineBlock_ApplicationSingleton
8079
*/
8180
protected $_diContainer;
8281

82+
protected ?DiContainerRuntime $_diContainerRuntime = null;
83+
8384
/**
8485
* @var ManualOrDecoratedActivationStrategy
8586
*/
@@ -109,6 +110,20 @@ public static function getInstance()
109110
return self::$s_instance;
110111
}
111112

113+
public function setDiContainerRuntime(DiContainerRuntime $diContainerRuntime): void
114+
{
115+
$this->_diContainerRuntime = $diContainerRuntime;
116+
}
117+
118+
public function getDiContainerRuntime(): DiContainerRuntime
119+
{
120+
if ($this->_diContainerRuntime === null) {
121+
throw new RuntimeException('The DiContainerRuntime is not ready yet!');
122+
}
123+
124+
return $this->_diContainerRuntime;
125+
}
126+
112127
/**
113128
* Get THE Log instance.
114129
*

library/EngineBlock/Corto/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ protected function _processProxyServerResponseBody(EngineBlock_Http_Response $re
439439

440440
protected function _getCoreProxy()
441441
{
442-
$twig = EngineBlock_ApplicationSingleton::getInstance()->getDiContainer()->getTwigEnvironment();
442+
$twig = EngineBlock_ApplicationSingleton::getInstance()->getDiContainerRuntime()->twig;
443443
return new EngineBlock_Corto_ProxyServer($twig);
444444
}
445445

library/EngineBlock/Corto/Module/Bindings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function __construct(EngineBlock_Corto_ProxyServer $server)
116116
$diContainer = EngineBlock_ApplicationSingleton::getInstance()->getDiContainer();
117117
$this->_featureConfiguration = $diContainer->getFeatureConfiguration();
118118
$this->_logger = EngineBlock_ApplicationSingleton::getLog();
119-
$this->twig = $diContainer->getTwigEnvironment();
119+
$this->twig = EngineBlock_ApplicationSingleton::getInstance()->getDiContainerRuntime()->twig;
120120
$this->acsLocationSchemeValidator = $diContainer->getAcsLocationSchemeValidator();
121121
$this->stepupIdentityProvider = $diContainer->getStepupIdentityProvider($this->_server);
122122
}

library/EngineBlock/Corto/Module/Services.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function serve($serviceName)
7575
private function factoryService($className, EngineBlock_Corto_ProxyServer $server)
7676
{
7777
$diContainer = EngineBlock_ApplicationSingleton::getInstance()->getDiContainer();
78+
$diContainerRuntime = EngineBlock_ApplicationSingleton::getInstance()->getDiContainerRuntime();
7879

7980
switch($className) {
8081
case EngineBlock_Corto_Module_Service_ProvideConsent::class :
@@ -84,7 +85,7 @@ private function factoryService($className, EngineBlock_Corto_ProxyServer $serve
8485
$diContainer->getConsentFactory(),
8586
$diContainer->getConsentService(),
8687
$diContainer->getAuthenticationStateHelper(),
87-
$diContainer->getTwigEnvironment(),
88+
$diContainerRuntime->twig,
8889
$diContainer->getProcessingStateHelper(),
8990
$diContainer->getDiscoverySelectionService()
9091
);
@@ -128,19 +129,19 @@ private function factoryService($className, EngineBlock_Corto_ProxyServer $serve
128129
return new EngineBlock_Corto_Module_Service_SingleSignOn(
129130
$server,
130131
$diContainer->getXmlConverter(),
131-
$diContainer->getTwigEnvironment(),
132+
$diContainerRuntime->twig,
132133
$diContainer->getServiceProviderFactory(),
133134
$diContainer->getDiscoverySelectionService()
134135
);
135136
case EngineBlock_Corto_Module_Service_ContinueToIdp::class :
136137
return new EngineBlock_Corto_Module_Service_ContinueToIdp(
137138
$server,
138139
$diContainer->getXmlConverter(),
139-
$diContainer->getTwigEnvironment(),
140+
$diContainerRuntime->twig,
140141
$diContainer->getServiceProviderFactory()
141142
);
142143
default :
143-
return new $className($server, $diContainer->getXmlConverter(), $diContainer->getTwigEnvironment());
144+
return new $className($server, $diContainer->getXmlConverter(), $diContainerRuntime->twig);
144145
}
145146
}
146147
}

src/OpenConext/EngineBlock/Metadata/Entity/AbstractRole.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
namespace OpenConext\EngineBlock\Metadata\Entity;
2020

21-
use DateTime;
2221
use Doctrine\ORM\Mapping as ORM;
2322
use OpenConext\EngineBlock\Metadata\Coins;
2423
use OpenConext\EngineBlock\Metadata\ContactPerson;
@@ -28,12 +27,17 @@
2827
use OpenConext\EngineBlock\Metadata\Organization;
2928
use OpenConext\EngineBlock\Metadata\Service;
3029
use OpenConext\EngineBlock\Metadata\X509\X509Certificate;
30+
use OpenConext\EngineBlockBundle\Doctrine\Type\SerializedArrayType;
31+
use OpenConext\EngineBlockBundle\Doctrine\Type\SerializedObjectType;
3132
use RuntimeException;
3233
use SAML2\Constants;
3334

3435
/**
3536
* Abstract base class for configuration entities.
3637
*
38+
* Note: This baseclass is extended by IdentityProvider and ServiceProvider. Both entities are stored in a single table.
39+
* This means all columns defined in both subclasses are nullable by default, even if you pass 'nullable: false'.
40+
*
3741
* @package OpenConext\EngineBlock\Metadata\Entity
3842
* @SuppressWarnings(PHPMD.TooManyFields)
3943
*
@@ -134,25 +138,25 @@ abstract class AbstractRole
134138
* @var Logo
135139
* @deprecated Will be removed in favour of using the Mdui value object, use the getter for this field instead
136140
*/
137-
#[ORM\Column(name: 'logo', type: \Doctrine\DBAL\Types\Types::OBJECT)]
141+
#[ORM\Column(name: 'logo', type: SerializedObjectType::NAME)]
138142
public $logo;
139143

140144
/**
141145
* @var Organization
142146
*/
143-
#[ORM\Column(name: 'organization_nl_name', type: \Doctrine\DBAL\Types\Types::OBJECT, nullable: true, length: 65535)]
147+
#[ORM\Column(name: 'organization_nl_name', type: SerializedObjectType::NAME, length: 65535, nullable: true)]
144148
public $organizationNl;
145149

146150
/**
147151
* @var Organization
148152
*/
149-
#[ORM\Column(name: 'organization_en_name', type: \Doctrine\DBAL\Types\Types::OBJECT, nullable: true, length: 65535)]
153+
#[ORM\Column(name: 'organization_en_name', type: SerializedObjectType::NAME, length: 65535, nullable: true)]
150154
public $organizationEn;
151155

152156
/**
153157
* @var Organization
154158
*/
155-
#[ORM\Column(name: 'organization_pt_name', type: \Doctrine\DBAL\Types\Types::OBJECT, nullable: true, length: 65535)]
159+
#[ORM\Column(name: 'organization_pt_name', type: SerializedObjectType::NAME, length: 65535, nullable: true)]
156160
public $organizationPt;
157161

158162
/**
@@ -179,7 +183,7 @@ abstract class AbstractRole
179183
/**
180184
* @var X509Certificate[]
181185
*/
182-
#[ORM\Column(name: 'certificates', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 65535)]
186+
#[ORM\Column(name: 'certificates', type: SerializedArrayType::NAME, length: 65535)]
183187
public $certificates = array();
184188

185189
/**
@@ -191,7 +195,7 @@ abstract class AbstractRole
191195
/**
192196
* @var ContactPerson[]
193197
*/
194-
#[ORM\Column(name: 'contact_persons', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 65535)]
198+
#[ORM\Column(name: 'contact_persons', type: SerializedArrayType::NAME, length: 65535)]
195199
public $contactPersons;
196200

197201
/**
@@ -203,13 +207,13 @@ abstract class AbstractRole
203207
/**
204208
* @var string[]
205209
*/
206-
#[ORM\Column(name: 'name_id_formats', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 65535)]
210+
#[ORM\Column(name: 'name_id_formats', type: SerializedArrayType::NAME, length: 65535)]
207211
public $supportedNameIdFormats;
208212

209213
/**
210214
* @var Service
211215
*/
212-
#[ORM\Column(name: 'single_logout_service', type: \Doctrine\DBAL\Types\Types::OBJECT, nullable: true, length: 65535)]
216+
#[ORM\Column(name: 'single_logout_service', type: SerializedObjectType::NAME, length: 65535, nullable: true)]
213217
public $singleLogoutService;
214218

215219
/**

0 commit comments

Comments
 (0)