This repository has been archived by the owner on May 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #430 from elcodi/feature/added-visithor
Added Bridge for Visithor Bundle
- Loading branch information
Showing
15 changed files
with
511 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 0 additions & 90 deletions
90
src/Elcodi/Admin/UserBundle/Controller/Stats/CustomerStatsController.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/Elcodi/Common/VisithorBridgeBundle/DependencyInjection/VisithorBridgeExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Elcodi package. | ||
* | ||
* Copyright (c) 2014-2015 Elcodi.com | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <yuhu@mmoreram.com> | ||
* @author Aldo Chiecchia <zimage@tiscali.it> | ||
* @author Elcodi Team <tech@elcodi.com> | ||
*/ | ||
|
||
namespace Elcodi\Common\VisithorBridgeBundle\DependencyInjection; | ||
|
||
use Elcodi\Bundle\CoreBundle\DependencyInjection\Abstracts\AbstractExtension; | ||
|
||
/** | ||
* Class VisithorBridgeExtension | ||
*/ | ||
class VisithorBridgeExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var string | ||
* | ||
* Extension name | ||
*/ | ||
const EXTENSION_NAME = 'visithor_bridge'; | ||
|
||
/** | ||
* Get the Config file location | ||
* | ||
* @return string Config file location | ||
*/ | ||
public function getConfigFilesLocation() | ||
{ | ||
return __DIR__ . '/../Resources/config'; | ||
} | ||
|
||
/** | ||
* Config files to load | ||
* | ||
* Each array position can be a simple file name if must be loaded always, | ||
* or an array, with the filename in the first position, and a boolean in | ||
* the second one. | ||
* | ||
* As a parameter, this method receives all loaded configuration, to allow | ||
* setting this boolean value from a configuration value. | ||
* | ||
* return array( | ||
* 'file1.yml', | ||
* 'file2.yml', | ||
* ['file3.yml', $config['my_boolean'], | ||
* ... | ||
* ); | ||
* | ||
* @param array $config Config definitions | ||
* | ||
* @return array Config files | ||
*/ | ||
protected function getConfigFiles(array $config) | ||
{ | ||
return [ | ||
'visithor', | ||
]; | ||
} | ||
|
||
/** | ||
* Returns the extension alias, same value as extension name | ||
* | ||
* @return string The alias | ||
*/ | ||
public function getAlias() | ||
{ | ||
return self::EXTENSION_NAME; | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
src/Elcodi/Common/VisithorBridgeBundle/Environment/EnvironmentBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Elcodi package. | ||
* | ||
* Copyright (c) 2014-2015 Elcodi.com | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <yuhu@mmoreram.com> | ||
* @author Aldo Chiecchia <zimage@tiscali.it> | ||
* @author Elcodi Team <tech@elcodi.com> | ||
*/ | ||
|
||
namespace Elcodi\Common\VisithorBridgeBundle\Environment; | ||
|
||
use Symfony\Component\HttpKernel\KernelInterface; | ||
use Visithor\Bundle\Environment\SymfonyEnvironmentBuilder; | ||
|
||
use Elcodi\Component\User\Repository\AdminUserRepository; | ||
use Elcodi\Component\User\Repository\CustomerRepository; | ||
|
||
/** | ||
* Class EnvironmentBuilder | ||
*/ | ||
class EnvironmentBuilder extends SymfonyEnvironmentBuilder | ||
{ | ||
/** | ||
* @var CustomerRepository | ||
* | ||
* Customer Repository | ||
*/ | ||
protected $customerRepository; | ||
|
||
/** | ||
* @var AdminUserRepository | ||
* | ||
* Admin User Repository | ||
*/ | ||
protected $adminUserRepository; | ||
|
||
/** | ||
* Construct | ||
* | ||
* @param CustomerRepository $customerRepository Customer Repository | ||
* @param AdminUserRepository $adminUserRepository Admin User Repository | ||
*/ | ||
public function __construct( | ||
CustomerRepository $customerRepository, | ||
AdminUserRepository $adminUserRepository | ||
) { | ||
$this->customerRepository = $customerRepository; | ||
$this->adminUserRepository = $adminUserRepository; | ||
} | ||
|
||
/** | ||
* Set up environment | ||
* | ||
* @param KernelInterface $kernel Kernel | ||
* | ||
* @return $this Self object | ||
*/ | ||
public function setUp(KernelInterface $kernel) | ||
{ | ||
parent::setUp($kernel); | ||
|
||
$this | ||
->executeCommand('doctrine:fixtures:load', [ | ||
'--fixtures' => $kernel | ||
->getRootDir() . '/../src/Elcodi/Fixtures', | ||
]) | ||
->executeCommand('elcodi:templates:load') | ||
->executeCommand('elcodi:templates:enable', [ | ||
'template' => 'StoreTemplateBundle', | ||
]) | ||
->executeCommand('elcodi:plugins:load') | ||
->executeCommand('assets:install') | ||
->executeCommand('assetic:dump'); | ||
} | ||
|
||
/** | ||
* Get authenticated user | ||
* | ||
* @param string $role Role | ||
* | ||
* @return mixed User for authentication | ||
*/ | ||
public function getAuthenticationUser($role) | ||
{ | ||
return 'ROLE_ADMIN' === $role | ||
? $this | ||
->adminUserRepository | ||
->findOneBy([ | ||
'email' => 'admin@admin.com', | ||
]) | ||
: $this | ||
->customerRepository | ||
->find([ | ||
'email' => 'customer@customer.com', | ||
]); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Elcodi/Common/VisithorBridgeBundle/Resources/config/visithor.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
|
||
# | ||
# Visithor Bridge | ||
# | ||
visitor.environment_builder: | ||
class: Elcodi\Common\VisithorBridgeBundle\Environment\EnvironmentBuilder | ||
arguments: | ||
- @elcodi.repository.customer | ||
- @elcodi.repository.admin_user |
Oops, something went wrong.