|
@@ -2,12 +2,15 @@
|
|
|
|
|
|
|
|
namespace Opentalent\OtCore\Website;
|
|
namespace Opentalent\OtCore\Website;
|
|
|
|
|
|
|
|
|
|
+use Doctrine\DBAL\DBALException;
|
|
|
use Opentalent\OtCore\Exception\InvalidWebsiteConfigurationException;
|
|
use Opentalent\OtCore\Exception\InvalidWebsiteConfigurationException;
|
|
|
use Opentalent\OtCore\Exception\NoSuchRecordException;
|
|
use Opentalent\OtCore\Exception\NoSuchRecordException;
|
|
|
use Opentalent\OtCore\Exception\NoSuchWebsiteException;
|
|
use Opentalent\OtCore\Exception\NoSuchWebsiteException;
|
|
|
use Opentalent\OtCore\Utility\RouteNormalizer;
|
|
use Opentalent\OtCore\Utility\RouteNormalizer;
|
|
|
use Psr\Http\Message\UriInterface;
|
|
use Psr\Http\Message\UriInterface;
|
|
|
|
|
+use Symfony\Component\Yaml\Exception\ParseException;
|
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
|
|
|
+use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
|
use TYPO3\CMS\Core\Http\Uri;
|
|
use TYPO3\CMS\Core\Http\Uri;
|
|
|
use TYPO3\CMS\Core\Site\Entity\Site;
|
|
use TYPO3\CMS\Core\Site\Entity\Site;
|
|
|
|
|
|
|
@@ -19,11 +22,11 @@ use TYPO3\CMS\Core\Site\Entity\Site;
|
|
|
class OtWebsiteRepository
|
|
class OtWebsiteRepository
|
|
|
{
|
|
{
|
|
|
/**
|
|
/**
|
|
|
- * @var \TYPO3\CMS\Core\Database\ConnectionPool
|
|
|
|
|
|
|
+ * @var ConnectionPool
|
|
|
*/
|
|
*/
|
|
|
- private \TYPO3\CMS\Core\Database\ConnectionPool $connectionPool;
|
|
|
|
|
|
|
+ private ConnectionPool $connectionPool;
|
|
|
|
|
|
|
|
- public function injectConnectionPool(\TYPO3\CMS\Core\Database\ConnectionPool $connectionPool)
|
|
|
|
|
|
|
+ public function injectConnectionPool(ConnectionPool $connectionPool)
|
|
|
{
|
|
{
|
|
|
$this->connectionPool = $connectionPool;
|
|
$this->connectionPool = $connectionPool;
|
|
|
}
|
|
}
|
|
@@ -72,6 +75,7 @@ class OtWebsiteRepository
|
|
|
* Get the OtWebsite of the given organization
|
|
* Get the OtWebsite of the given organization
|
|
|
*
|
|
*
|
|
|
* @throws NoSuchWebsiteException
|
|
* @throws NoSuchWebsiteException
|
|
|
|
|
+ * @throws DBALException
|
|
|
*/
|
|
*/
|
|
|
public function getWebsiteByOrganizationId(int $organizationId, bool $withRestrictions = true): array
|
|
public function getWebsiteByOrganizationId(int $organizationId, bool $withRestrictions = true): array
|
|
|
{
|
|
{
|
|
@@ -328,12 +332,12 @@ class OtWebsiteRepository
|
|
|
/**
|
|
/**
|
|
|
* Try to retrieve the website matching the given Uri and return the given website
|
|
* Try to retrieve the website matching the given Uri and return the given website
|
|
|
*
|
|
*
|
|
|
- * @param \Psr\Http\Message\UriInterface $uri
|
|
|
|
|
|
|
+ * @param UriInterface $uri
|
|
|
* @param bool $devMode
|
|
* @param bool $devMode
|
|
|
* @return Site
|
|
* @return Site
|
|
|
* @throws NoSuchWebsiteException
|
|
* @throws NoSuchWebsiteException
|
|
|
*/
|
|
*/
|
|
|
- public function matchUriToWebsite(\Psr\Http\Message\UriInterface $uri, bool $devMode=false, bool $withRestrictions = true): array
|
|
|
|
|
|
|
+ public function matchUriToWebsite(UriInterface $uri, bool $devMode=false, bool $withRestrictions = true): array
|
|
|
{
|
|
{
|
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('ot_websites');
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('ot_websites');
|
|
|
|
|
|
|
@@ -416,7 +420,7 @@ class OtWebsiteRepository
|
|
|
$filename = $configs_directory . $identifier . "/config.yaml";
|
|
$filename = $configs_directory . $identifier . "/config.yaml";
|
|
|
try {
|
|
try {
|
|
|
$yamlConfig = Yaml::parseFile($filename);
|
|
$yamlConfig = Yaml::parseFile($filename);
|
|
|
- } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
|
|
|
|
|
|
|
+ } catch (ParseException $e) {
|
|
|
throw new \RuntimeException("No configuration file found for identifier " . $identifier);
|
|
throw new \RuntimeException("No configuration file found for identifier " . $identifier);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -442,7 +446,7 @@ class OtWebsiteRepository
|
|
|
if ($yamlConfig['rootPageId'] === $rootUid) {
|
|
if ($yamlConfig['rootPageId'] === $rootUid) {
|
|
|
return [$filename, $yamlConfig];
|
|
return [$filename, $yamlConfig];
|
|
|
}
|
|
}
|
|
|
- } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
|
|
|
|
|
|
|
+ } catch (ParseException $e) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -456,7 +460,7 @@ class OtWebsiteRepository
|
|
|
if ($yamlConfig['rootPageId'] === $rootUid) {
|
|
if ($yamlConfig['rootPageId'] === $rootUid) {
|
|
|
return [$filename, $yamlConfig];
|
|
return [$filename, $yamlConfig];
|
|
|
}
|
|
}
|
|
|
- } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
|
|
|
|
|
|
|
+ } catch (ParseException $e) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|