Update basic stuff
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "pcm/example-bundle",
|
"name": "pcm/badge-bundle",
|
||||||
"description": "PCM Example Bundle",
|
"description": "PCM Badge Bundle",
|
||||||
"type": "symfony-bundle",
|
"type": "symfony-bundle",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "dev-develop",
|
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Bradley Goode",
|
"name": "Bradley Goode",
|
||||||
@@ -14,25 +13,21 @@
|
|||||||
"email": "mf@pcmsystems.co.uk"
|
"email": "mf@pcmsystems.co.uk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Pcm\\ExampleBundle\\": "src/"
|
"Pcm\\BadgeExampleBundle\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Pcm\\ExampleBundle\\Tests\\": "tests/"
|
"Pcm\\BadgeBundle\\Tests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"require": {
|
"require": {
|
||||||
"symfony/dependency-injection": "^7.1",
|
"symfony/dependency-injection": "^7.1",
|
||||||
"symfony/framework-bundle": "^7.1",
|
"symfony/framework-bundle": "^7.1",
|
||||||
"symfony/yaml": "^7.1"
|
"symfony/yaml": "^7.1"
|
||||||
},
|
},
|
||||||
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/test-pack": "^1.1",
|
"symfony/test-pack": "^1.1",
|
||||||
"friendsofphp/php-cs-fixer": "^3.61"
|
"friendsofphp/php-cs-fixer": "^3.61"
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ declare(strict_types=1);
|
|||||||
// Most of the time we probably want to have access to our bundle
|
// Most of the time we probably want to have access to our bundle
|
||||||
// in all environments (prod, dev, test etc).
|
// in all environments (prod, dev, test etc).
|
||||||
return [
|
return [
|
||||||
Pcm\ExampleBundle\PcmExampleBundle::class => ['all' => true],
|
Pcm\BadgeBundle\PcmBadgeBundle::class => ['all' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
|
|||||||
// This file is imported and used by the main bundle class to
|
// This file is imported and used by the main bundle class to
|
||||||
// define how the configuration should look.
|
// define how the configuration should look.
|
||||||
return static function (DefinitionConfigurator $definition): void {
|
return static function (DefinitionConfigurator $definition): void {
|
||||||
$definition->rootNode()
|
// $definition->rootNode()
|
||||||
->children()
|
// ->children()
|
||||||
->scalarNode('name')->defaultValue('Mr. NoName')->cannotBeEmpty()->end()
|
// ->scalarNode('name')->defaultValue('Mr. NoName')->cannotBeEmpty()->end()
|
||||||
->end()
|
// ->end()
|
||||||
;
|
// ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ services:
|
|||||||
# Read the documentation to see why we do this:
|
# Read the documentation to see why we do this:
|
||||||
# https://symfony.com/doc/current/service_container/autowiring.html#service-autowiring-alias
|
# https://symfony.com/doc/current/service_container/autowiring.html#service-autowiring-alias
|
||||||
#
|
#
|
||||||
Pcm\ExampleBundle\Greeting:
|
# Pcm\ExampleBundle\Greeting:
|
||||||
public: false
|
# public: false
|
||||||
alias: pcm_example.greeting
|
# alias: pcm_example.greeting
|
||||||
|
|
||||||
|
|
||||||
# Mark the alias we created as public.
|
# Mark the alias we created as public.
|
||||||
pcm_example.greeting:
|
# pcm_example.greeting:
|
||||||
public: true
|
# public: true
|
||||||
class: Pcm\ExampleBundle\Greeting
|
# class: Pcm\ExampleBundle\Greeting
|
||||||
|
|
||||||
|
|
||||||
# If we were defining a twig extension, we'd want to add the twig.runtime tag
|
# If we were defining a twig extension, we'd want to add the twig.runtime tag
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Pcm\ExampleBundle;
|
|
||||||
|
|
||||||
final class Greeting
|
|
||||||
{
|
|
||||||
public function __construct(private string $name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function greetPerson(): string
|
|
||||||
{
|
|
||||||
return sprintf("Hello there %s! Hope you're well.", $this->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Pcm\ExampleBundle;
|
namespace Pcm\BadgeBundle;
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
|
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
|
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
|
||||||
|
|
||||||
final class PcmExampleBundle extends AbstractBundle
|
final class PcmBadgeBundle extends AbstractBundle
|
||||||
{
|
{
|
||||||
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
|
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
|
||||||
{
|
{
|
||||||
@@ -27,10 +27,10 @@ final class PcmExampleBundle extends AbstractBundle
|
|||||||
*
|
*
|
||||||
* (see services.yaml)
|
* (see services.yaml)
|
||||||
*/
|
*/
|
||||||
$container->services()
|
// $container->services()
|
||||||
->get('pcm_example.greeting')
|
// ->get('pcm_example.greeting')
|
||||||
->arg('$name', $config['name'])
|
// ->arg('$name', $config['name'])
|
||||||
;
|
// ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure(DefinitionConfigurator $definition): void
|
public function configure(DefinitionConfigurator $definition): void
|
||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Pcm\ExampleBundle\Tests;
|
namespace Pcm\BadgeBundle\Tests;
|
||||||
|
|
||||||
use Pcm\ExampleBundle\PcmExampleBundle;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ final class TestKernel extends Kernel
|
|||||||
public function registerBundles(): array
|
public function registerBundles(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new PcmExampleBundle()
|
new PcmBadgeBundle()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user