Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Improved the Plugin engine
Browse files Browse the repository at this point in the history
* Added the basis for new plugin engine.
* Fields are generated dinamically, so making new plugins are more easy since now
* Added FreePaymentBundle and PaypalWebCheckoutBundle as plugins
* Added the basis for new payment engine
  • Loading branch information
mmoreram committed Jun 8, 2015
1 parent 92c314a commit a9b3002
Show file tree
Hide file tree
Showing 94 changed files with 1,241 additions and 746 deletions.
27 changes: 13 additions & 14 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Elcodi\Bundle\TestCommonBundle\Functional\Abstracts\AbstractElcodiKernel;
use Elcodi\Bundle\CoreBundle\Traits\BundleDependenciesResolver;

/**
* Class AppKernel
*/
class AppKernel extends Kernel
class AppKernel extends AbstractElcodiKernel
{
use BundleDependenciesResolver;

/**
* Returns an array of bundles to register.
*
Expand Down Expand Up @@ -62,14 +66,6 @@ public function registerBundles()
new Mmoreram\ControllerExtraBundle\ControllerExtraBundle(),
new Mmoreram\CacheFlushBundle\CacheFlushBundle(),

/**
* Payment suite
*/
new PaymentSuite\PaymentCoreBundle\PaymentCoreBundle(),
new PaymentSuite\FreePaymentBundle\FreePaymentBundle(),
new PaymentSuite\PaypalWebCheckoutBundle\PaypalWebCheckoutBundle(),
new PaymentSuite\PaymillBundle\PaymillBundle(),

/**
* Elcodi core bundles
*/
Expand All @@ -94,11 +90,12 @@ public function registerBundles()
new Elcodi\Bundle\ConfigurationBundle\ElcodiConfigurationBundle(),
new Elcodi\Bundle\PageBundle\ElcodiPageBundle(),
new Elcodi\Bundle\MetricBundle\ElcodiMetricBundle(),
new Elcodi\Bundle\PluginBundle\ElcodiPluginBundle(),
new Elcodi\Bundle\PluginBundle\ElcodiPluginBundle($this),
new Elcodi\Bundle\CommentBundle\ElcodiCommentBundle(),
new Elcodi\Bundle\ZoneBundle\ElcodiZoneBundle(),
new Elcodi\Bundle\ShippingBundle\ElcodiShippingBundle(),
new Elcodi\Bundle\SitemapBundle\ElcodiSitemapBundle(),
new Elcodi\Bundle\PaymentBundle\ElcodiPaymentBundle(),

/**
* Elcodi store bundle
Expand Down Expand Up @@ -131,21 +128,21 @@ public function registerBundles()
new Elcodi\Admin\MediaBundle\AdminMediaBundle(),
new Elcodi\Admin\NewsletterBundle\AdminNewsletterBundle(),
new Elcodi\Admin\ProductBundle\AdminProductBundle(),
new Elcodi\Admin\ConfigurationBundle\AdminConfigurationBundle(),
new Elcodi\Admin\PageBundle\AdminPageBundle(),
new Elcodi\Admin\TemplateBundle\AdminTemplateBundle(),
new Elcodi\Admin\MetricBundle\AdminMetricBundle(),
new Elcodi\Admin\PluginBundle\AdminPluginBundle(),
new Elcodi\Admin\ShippingBundle\AdminShippingBundle(),
new Elcodi\Admin\GeoBundle\AdminGeoBundle(),
new Elcodi\Admin\ConfigurationBundle\AdminConfigurationBundle(),
new Elcodi\Admin\PaymentBundle\AdminPaymentBundle(),

/**
* Elcodi common bundle
*/
new Elcodi\Common\FirewallBundle\ElcodiFirewallBundle(),
new Elcodi\Common\BambooBundle\ElcodiBambooBundle(),
new Elcodi\Common\ConfigurationBundle\ConfigurationAnnotationBundle(),
new Elcodi\Common\PaymentBridgeBundle\PaymentBridgeBundle(),

/**
* Elcodi Plugins
Expand All @@ -158,6 +155,8 @@ public function registerBundles()
new Elcodi\Plugin\TwitterBundle\ElcodiTwitterBundle(),
new Elcodi\Plugin\FacebookBundle\ElcodiFacebookBundle(),
new Elcodi\Plugin\StoreTemplateBundle\StoreTemplateBundle(),
new Elcodi\Plugin\PaypalWebCheckoutBundle\ElcodiPaypalWebCheckoutBundle(),
new Elcodi\Plugin\FreePaymentBundle\ElcodiFreePaymentBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
Expand All @@ -168,10 +167,10 @@ public function registerBundles()

if (class_exists('Visithor\Bundle\VisithorBundle')) {
$bundles[] = new Visithor\Bundle\VisithorBundle();
$bundles[] = new Elcodi\Common\VisithorBridgeBundle\VisithorBridgeBundle();
$bundles[] = new Elcodi\Bridge\VisithorBridgeBundle\ElcodiVisithorBridgeBundle();
}

return $bundles;
return $this->getBundleInstances($bundles);
}

/**
Expand Down
8 changes: 2 additions & 6 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ imports:
- { resource: common/metrics.yml }
- { resource: common/sitemap.yml }

# Payment-specific bundle and elcodi configuration
- { resource: @PaymentBridgeBundle/Resources/config/configuration.yml }
- { resource: @PaymentBridgeBundle/Resources/config/payment.yml }

# Specific service overrides
- { resource: common/services.yml }

# Project-specific configuration
- { resource: config_local.yml }

framework:
secret: "%secret%"
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing/routing.yml"
strict_requirements: ~
Expand All @@ -44,7 +40,7 @@ framework:

# Twig Configuration
twig:
debug: "%kernel.debug%"
debug: "%kernel.debug%"
strict_variables: false

globals:
Expand Down
16 changes: 7 additions & 9 deletions app/config/routing/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ admin_routes:
options:
i18n: false

#
# Plugin routes
#
plugin_routes:
resource: "routing_plugin.yml"
prefix: /%bamboo_admin_prefix%
options:
i18n: false

#
# API routes
#
Expand All @@ -49,6 +40,13 @@ media_routes:
options:
i18n: false

#
# Plugin routes
#
plugin_routes:
resource: .
type: elcodi.routes.plugins

#
# Per project routes
# Add your routes in this file
Expand Down
3 changes: 3 additions & 0 deletions app/config/routing/routing_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ admin_geo:
admin_languages:
resource: "@AdminLanguageBundle/Resources/config/routing.yml"

admin_payments:
resource: "@AdminPaymentBundle/Resources/config/routing.yml"

admin_login_check:
path: /login_check

Expand Down
10 changes: 0 additions & 10 deletions app/config/routing/routing_plugin.yml

This file was deleted.

3 changes: 0 additions & 3 deletions app/config/routing/routing_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ store_currency:
store_page:
resource: "@StorePageBundle/Resources/config/routing.yml"

store_payment:
resource: "@PaymentBridgeBundle/Resources/config/routing.yml"

store_login_check:
path: /login_check

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@
},
"autoload": {
"psr-4": {
"": "src/",
"": [
"src/",
"plugin/"
],
"Elcodi\\": [
"src/Elcodi"
]
Expand Down
8 changes: 3 additions & 5 deletions scripts/.reload
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ rm -Rf /tmp/*
rm -Rf /tmp/Elcodi/*
rm -Rf /tmp/Bamboo/*


php app/console doctrine:database:drop --connection=default --force
php app/console doctrine:database:create --connection=default
php app/console doctrine:schema:update --force --em=default
php app/console doctrine:fixtures:load --fixtures="src/Elcodi/Fixtures" --no-interaction
mysql -uroot -proot bamboo < ~/location.sql

php app/console elcodi:plugins:load
php app/console elcodi:configuration:set store.template "\"StoreTemplateBundle\""
php app/console elcodi:configuration:set store.under_construction false
php app/console elcodi:configuration:set store.name "\"Engonga store\""
php app/console elcodi:configuration:set store.enabled true
/usr/bin/env php app/console elcodi:configuration:set store.enabled 1
/usr/bin/env php app/console elcodi:configuration:set store.under_construction 0
/usr/bin/env php app/console elcodi:configuration:set store.template "\"StoreTemplateBundle\""

php app/console ass:install
php app/console ass:dump
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

use Elcodi\Admin\ConfigurationBundle\DependencyInjection\AdminConfigurationExtension;

/**
* Class AdminConfigurationBundle
*/
Expand All @@ -34,6 +32,6 @@ class AdminConfigurationBundle extends Bundle
*/
public function getContainerExtension()
{
return new AdminConfigurationExtension();
return null;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
* @author Elcodi Team <[email protected]>
*/

namespace Elcodi\Common\PaymentBridgeBundle;
namespace Elcodi\Admin\PaymentBundle;

use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

use Elcodi\Common\PaymentBridgeBundle\DependencyInjection\PaymentBridgeExtension;

/**
* Class PaymentBridgeBundle
* Class AdminPaymentBundle
*/
class PaymentBridgeBundle extends Bundle
class AdminPaymentBundle extends Bundle
{
/**
* Returns the bundle's container extension.
Expand All @@ -34,6 +32,6 @@ class PaymentBridgeBundle extends Bundle
*/
public function getContainerExtension()
{
return new PaymentBridgeExtension();
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* @author Elcodi Team <[email protected]>
*/

namespace Elcodi\Admin\ConfigurationBundle\Controller;
namespace Elcodi\Admin\PaymentBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use Elcodi\Admin\CoreBundle\Controller\Abstracts\AbstractAdminController;
use Elcodi\Component\Plugin\PluginTypes;

/**
* Class Controller for payment configuration
Expand All @@ -39,19 +39,22 @@ class PaymentController extends AbstractAdminController
*
* @Route(
* path = "",
* name = "admin_payment_configuration_list"
* name = "admin_payment_list",
* methods = {"GET"}
* )
* @Template
* @Method({"GET"})
* @Template("AdminPluginBundle:Plugin:list.html.twig")
*/
public function listAction()
{
$enabledPaymentMethods = $this
->container
->getParameter('store.payment_bridge.enabled_methods');
$plugins = $this
->get('elcodi.repository.plugin')
->findBy([
'type' => PluginTypes::TYPE_PLUGIN,
'category' => 'payment',
]);

return [
'enabledPaymentMethods' => $enabledPaymentMethods,
'plugins' => $plugins,
];
}
}
3 changes: 3 additions & 0 deletions src/Elcodi/Admin/PaymentBundle/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AdminPaymentBundle:
resource: "@AdminPaymentBundle/Controller/"
type: annotation
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
* @author Elcodi Team <[email protected]>
*/

namespace Elcodi\Admin\ConfigurationBundle\DependencyInjection;
namespace Elcodi\Bridge\PaymentSuiteBridgeBundle\DependencyInjection;

use Elcodi\Bundle\CoreBundle\DependencyInjection\Abstracts\AbstractExtension;

/**
* Class AdminConfigurationExtension
* Class ElcodiPaymentSuiteBridgeExtension
*/
class AdminConfigurationExtension extends AbstractExtension
class ElcodiPaymentSuiteBridgeExtension extends AbstractExtension
{
/**
* @var string
*
* Extension name
*/
const EXTENSION_NAME = 'admin_configuration';
const EXTENSION_NAME = 'elcodi_payment_suite_bridge';

/**
* Get the Config file location
Expand All @@ -44,20 +44,15 @@ public function getConfigFilesLocation()
/**
* Config files to load
*
* return array(
* 'file1.yml',
* 'file2.yml',
* ...
* );
*
* @param array $config Config
* @param array $config Config array
*
* @return array Config files
*/
public function getConfigFiles(array $config)
{
return [
'formTypes',
'services',
'eventListeners',
];
}

Expand All @@ -68,6 +63,6 @@ public function getConfigFiles(array $config)
*/
public function getAlias()
{
return self::EXTENSION_NAME;
return static::EXTENSION_NAME;
}
}
Loading

0 comments on commit a9b3002

Please sign in to comment.