Skip to content

Commit

Permalink
変更がわかりづらくなるのでプラグインを展開しておく
Browse files Browse the repository at this point in the history
  • Loading branch information
kiy0taka authored and chihiro-adachi committed Jan 11, 2024
1 parent 7c3a543 commit 76547bf
Show file tree
Hide file tree
Showing 68 changed files with 1,398 additions and 25 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}

- name: Setup pcov
run: |
sudo apt-fast install -y php8.1-pcov
Expand Down Expand Up @@ -155,7 +155,11 @@ jobs:
run: |
if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi
docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2
cp codeception/_data/plugins/*-1.0.0.tgz repos
for d in $(ls codeception/_data/plugins | grep 1.0.0)
do
(cd codeception/_data/plugins/$d; tar zcf ../../../../repos/${d}.tgz *)
done
- name: Setup pcov
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ jobs:
run: |
if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi
docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2
cp codeception/_data/plugins/*-1.0.0.tgz repos
for d in $(ls codeception/_data/plugins | grep 1.0.0)
do
(cd codeception/_data/plugins/$d; tar zcf ../../../../repos/${d}.tgz *)
done
- name: Start PHP Development Server
if: ${{ matrix.group != 'restrict-fileupload' }}
Expand Down
Binary file removed codeception/_data/plugins/Assets-1.0.0.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
* assets.js
*/
9 changes: 9 additions & 0 deletions codeception/_data/plugins/Assets-1.0.0/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ec-cube/assets",
"version": "1.0.0",
"description": "アセットを含むプラグイン",
"type": "eccube-plugin",
"extra": {
"code": "Assets"
}
}
Binary file removed codeception/_data/plugins/Assets-1.0.1.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
* assets.js
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**
* updated.js
*/
9 changes: 9 additions & 0 deletions codeception/_data/plugins/Assets-1.0.1/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ec-cube/assets",
"version": "1.0.1",
"description": "アセットを含むプラグイン",
"type": "eccube-plugin",
"extra": {
"code": "Assets"
}
}
Binary file removed codeception/_data/plugins/Boomerang-1.0.0.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\Boomerang\Controller;


use Eccube\Controller\AbstractController;
use Eccube\Entity\Cart;
use Eccube\Repository\CartRepository;
use Plugin\Boomerang\Entity\Bar;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class BoomerangController extends AbstractController
{
/**
* @var CartRepository
*/
private $cartRepository;

public function __construct(CartRepository $cartRepository)
{
$this->cartRepository = $cartRepository;
}

/**
* @Route("/boomerang", name="boomerang")
* @return JsonResponse
*/
public function index()
{
/** @var Cart[] $list */
$list = $this->cartRepository->findAll();
$ids = array_map(function (Cart $c) { return $c->getId(); }, $list);

return $this->json($ids);
}

/**
* @Route("/boomerang/new")
*/
public function new()
{
$Bar = new Bar();
$Bar->name = 'bar';
$this->entityManager->persist($Bar);

$Cart = new Cart();
$Cart->setTotalPrice(0);
$Cart->setDeliveryFeeTotal(0);
$Cart->bar = $Bar;

$this->cartRepository->save($Cart);
$this->entityManager->flush();

return $this->redirectToRoute('boomerang');
}
}
44 changes: 44 additions & 0 deletions codeception/_data/plugins/Boomerang-1.0.0/Entity/Bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\Boomerang\Entity;

use Doctrine\ORM\Mapping as ORM;

if (!class_exists('Plugin\Boomerang\Entity\Bar')) {

/**
* @ORM\Table(name="dtb_bar")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
* @ORM\HasLifecycleCallbacks()
* @ORM\Entity(repositoryClass="Plugin\Boomerang\Repository\BarRepository")
*/
class Bar
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
public $id;

/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
public $name;
}
}
27 changes: 27 additions & 0 deletions codeception/_data/plugins/Boomerang-1.0.0/Entity/CartTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Plugin\Boomerang\Entity;

use Doctrine\ORM\Mapping as ORM;
use Eccube\Annotation\EntityExtension;

/**
* @EntityExtension("Eccube\Entity\Cart")
*/
trait CartTrait
{
/**
* @var boolean
* @ORM\Column(name="is_boomerang", type="boolean", options={"default":false}, nullable=true)
*/
public $is_boomerang;

/**
* @var Bar
* @ORM\ManyToOne(targetEntity="Plugin\Boomerang\Entity\Bar")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="bar_id", referencedColumnName="id")
* })
*/
public $bar;
}
39 changes: 39 additions & 0 deletions codeception/_data/plugins/Boomerang-1.0.0/PluginManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Plugin\Boomerang;

use Eccube\Plugin\AbstractPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

class PluginManager extends AbstractPluginManager
{
public function install(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Install Boomerang 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
}

public function enable(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Enable Boomerang 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
}

public function disable(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Disable Boomerang 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
}

public function update(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Update Boomerang 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
}

public function uninstall(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Uninstall Boomerang 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\Boomerang\Repository;


use Eccube\Repository\AbstractRepository;
use Plugin\Boomerang\Entity\Bar;
use Doctrine\Persistence\ManagerRegistry as RegistryInterface;

class BarRepository extends AbstractRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Bar::class);
}
}
1 change: 1 addition & 0 deletions codeception/_data/plugins/Boomerang-1.0.0/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"ec-cube\/boomerang","description":"\u30d6\u30fc\u30e1\u30e9\u30f3","version":"1.0.0","type":"eccube-plugin","require":{"ec-cube\/plugin-installer":"^2.0@dev"},"extra":{"code":"Boomerang","id":100}}
Binary file removed codeception/_data/plugins/Boomerang10-1.0.0.tgz
Binary file not shown.
20 changes: 20 additions & 0 deletions codeception/_data/plugins/Boomerang10-1.0.0/Entity/BarTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Plugin\Boomerang10\Entity;


use Eccube\Annotation\EntityExtension;
use Doctrine\ORM\Mapping as ORM;

/**
* @EntityExtension("Plugin\Boomerang\Entity\Bar")
*/
trait BarTrait
{
/**
* @var string
*
* @ORM\Column(name="mail", type="string", length=255, nullable=true)
*/
public $mail;
}
57 changes: 57 additions & 0 deletions codeception/_data/plugins/Boomerang10-1.0.0/PluginManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace Plugin\Boomerang10;

use Doctrine\ORM\EntityManager;
use Eccube\Plugin\AbstractPluginManager;
use Plugin\Boomerang\Entity\Bar;
use Symfony\Component\DependencyInjection\ContainerInterface;

class PluginManager extends AbstractPluginManager
{
public function install(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Install Boomerang10 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
/** @var EntityManager $entityManager */
$entityManager = $container->get('doctrine.orm.entity_manager');
$bar = new Bar();
$bar->id = 2;
$bar->name = 'Boomerang10 1.0.0';
$bar->mail = '[email protected]';
$entityManager->persist($bar);
$entityManager->flush($bar);
}

public function enable(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Enable Boomerang10 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
$entityManager = $container->get('doctrine.orm.entity_manager');
$entityManager->find(Bar::class, 2);
}

public function disable(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Disable Boomerang10 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
$entityManager = $container->get('doctrine.orm.entity_manager');
$entityManager->find(Bar::class, 2);
}

public function update(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Update Boomerang10 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
$entityManager = $container->get('doctrine.orm.entity_manager');
$entityManager->find(Bar::class, 2);
}

public function uninstall(array $config, ContainerInterface $container) {
echo "*******************************************".PHP_EOL;
echo "Uninstall Boomerang10 1.0.0".PHP_EOL;
echo "*******************************************".PHP_EOL;
$entityManager = $container->get('doctrine.orm.entity_manager');
$entityManager->find(Bar::class, 2);
}
}
13 changes: 13 additions & 0 deletions codeception/_data/plugins/Boomerang10-1.0.0/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "ec-cube/boomerang10",
"description": "ブーメラン・10",
"version": "1.0.0",
"type": "eccube-plugin",
"require": {
"ec-cube/boomerang": "~1.0.0"
},
"extra": {
"code": "Boomerang10",
"id": 102
}
}
Binary file removed codeception/_data/plugins/Bundle-1.0.0.tgz
Binary file not shown.
28 changes: 28 additions & 0 deletions codeception/_data/plugins/Bundle-1.0.0/Bundle/BundleBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Plugin\Bundle\Bundle;

use Plugin\Bundle\DependencyInjection\Compiler\BundleCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class BundleBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);

$container->addCompilerPass(new BundleCompilerPass());
}
}
Loading

0 comments on commit 76547bf

Please sign in to comment.