Skip to content

Commit

Permalink
Prevent Doctrine from visiting Concrete9-specific files (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Nov 21, 2023
1 parent 12c37dd commit be37602
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use Concrete\Core\Asset\Asset;
use Concrete\Core\Asset\AssetList;
use Concrete\Core\Command\Task\Manager as TaskManager;
use Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface;
use Concrete\Core\Database\EntityManager\Provider\StandardPackageProvider;
use Concrete\Core\Multilingual\Page\Section\Section;
use Concrete\Core\Package\Package;
use Concrete\Core\Page\Page;
Expand All @@ -19,7 +21,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Whoops\Exception\ErrorException;

class Controller extends Package
class Controller extends Package implements ProviderAggregateInterface
{
protected $pkgHandle = 'community_store';
protected $appVersionRequired = '8.5';
Expand All @@ -37,7 +39,7 @@ class Controller extends Package

/**
* @var string
*/
*/
private static $upgradingFromVersion = '';

public function getPackageDescription()
Expand Down Expand Up @@ -100,7 +102,7 @@ public function upgradeCoreData()
self::$upgradingFromVersion = $packageEntity === null ? '' : (string) $packageEntity->getPackageVersion();
parent::upgradeCoreData();
}

public function upgrade()
{
if (self::$upgradingFromVersion !== '' && version_compare(self::$upgradingFromVersion, '2.6.0') < 0) {
Expand Down Expand Up @@ -205,7 +207,7 @@ public function on_start()
]
);

$select2 = $al->getAssetGroup('select2');
$select2 = $al->getAssetGroup('select2');

if (!$select2) {
$al->register('css', 'select2', 'css/select2/select2.css', ['version' => '3.5.4', 'position' => Asset::ASSET_POSITION_HEADER, 'minify' => false, 'combine' => false], $this);
Expand Down Expand Up @@ -316,9 +318,9 @@ public static function returnHeaderJS()
var QTYMESSAGE = '" . t('Quantity must be greater than zero') . "';
var CHECKOUTSCROLLOFFSET = " . Config::get('community_store.checkout_scroll_offset', 0) . ";
var CURRENCYCODE = '" . (Config::get('community_store.currency') ? Config::get('community_store.currency') : '') . "';
var CURRENCYSYMBOL = '" . Config::get('community_store.symbol') . "';
var CURRENCYDECIMAL = '" . Config::get('community_store.whole') . "';
var CURRENCYGROUP = '" . Config::get('community_store.thousand') . "';
var CURRENCYSYMBOL = '" . Config::get('community_store.symbol') . "';
var CURRENCYDECIMAL = '" . Config::get('community_store.whole') . "';
var CURRENCYGROUP = '" . Config::get('community_store.thousand') . "';
</script>
";
}
Expand Down Expand Up @@ -346,4 +348,31 @@ private function registerEventSubscribers()
$entityManager = $this->app->make(EntityManagerInterface::class);
$entityManager->getEventManager()->addEventSubscriber($subscriber);
}

/**
* {@inheritdoc}
*
* @see \Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface::getEntityManagerProvider()
*/
public function getEntityManagerProvider()
{
$locations = [
'src/Concrete/Entity' => 'Concrete\Package\CommunityStore\Entity',
];
foreach ([
'Discount',
'Group',
'Manufacturer',
'Multilingual',
'Order',
'Payment',
'Product',
'Shipping',
'Tax',
] as $chunk) {
$locations['src/CommunityStore/' . $chunk] = 'Concrete\Package\CommunityStore\Src\CommunityStore\\' . $chunk;
}

return new StandardPackageProvider($this->app, $this, $locations);;
}
}

0 comments on commit be37602

Please sign in to comment.