Remove bundle, add services in sculpin_kernel.yml

This commit is contained in:
Oliver Davies 2019-09-30 18:33:28 +01:00
parent 278c7a1d44
commit ed4133b573
13 changed files with 341 additions and 479 deletions

View file

@ -1,6 +1,5 @@
<?php
use App\Talks\SculpinTalksBundle;
use Opdavies\Sculpin\Bundle\ContentGeneratorBundle\SculpinContentGeneratorBundle;
use Opdavies\Sculpin\Bundle\GistEmbedBundle\SculpinGistEmbedBundle;
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
@ -17,8 +16,6 @@ class SculpinKernel extends AbstractKernel
SculpinContentGeneratorBundle::class,
SculpinGistEmbedBundle::class,
SculpinTwigMarkdownBundle::class,
SculpinTalksBundle::class,
];
}
}

View file

@ -8,3 +8,8 @@ sculpin_content_types:
talks:
permalink: talks/:basename/
taxonomies: [tags]
services:
App\TwigExtension\Talk\TalksExtension:
tags:
- { name: twig.extension }

View file

@ -35,6 +35,7 @@
"opdavies/sculpin-twig-markdown-bundle": "^0.1",
"phpstan/phpstan": "^0.11.8",
"sculpin/sculpin": "^3.0",
"tightenco/collect": "^5.4",
"tsphethean/sculpin-related-posts-bundle": "~0.1.0",
"wikimedia/composer-merge-plugin": "^1.4"
},
@ -49,19 +50,12 @@
},
"autoload": {
"psr-4": {
"App\\Talks\\": "src/Talks/src"
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\Talks\\": "src/Talks/tests"
}
},
"extra": {
"merge-plugin": {
"include": [
"src/*/composer.json"
]
"App\\Tests\\": "tests"
}
}
}

717
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@
stopOnFailure="true">
<testsuites>
<testsuite name="Talks">
<directory suffix="Test.php">src/Talks/tests</directory>
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -1,30 +0,0 @@
# Talks Bundle
## Twig Extensions
### Functions
* `getTalks()` - get all talks
```twig
{% set talks = getTalks(data.talks) %}
```
### Filters
* `events` - get events from talks
```twig
{% set talks = getTalks(data.talks)|events
```
* `past` - filter by past events
```twig
{% set talks = getTalks(data.talks)|past
```
* `upcoming` - filter by current and upcoming events
```twig
{% set talks = getTalks(data.talks)|upcoming
```

View file

@ -1,5 +0,0 @@
{
"require": {
"tightenco/collect": "^5.4"
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace App\Talks\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
class SculpinTalksExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
}
}

View file

@ -1,5 +0,0 @@
services:
twig.format_talks:
class: 'App\Talks\TwigExtension\TalksExtension'
tags:
- { name: twig.extension }

View file

@ -1,9 +0,0 @@
<?php
namespace App\Talks;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class SculpinTalksBundle extends Bundle
{
}

View file

@ -1,6 +1,6 @@
<?php
namespace App\Talks\TwigExtension;
namespace App\TwigExtension\Talk;
use Sculpin\Contrib\ProxySourceCollection\ProxySourceCollection;
use Tightenco\Collect\Support\Collection;

View file

@ -1,8 +1,8 @@
<?php
namespace App\Tests\Talks;
namespace App\Tests\Event;
use App\Talks\TwigExtension\TalksExtension;
use App\TwigExtension\Talk\TalksExtension;
use DateTime;
use PHPUnit\Framework\TestCase;
use Tightenco\Collect\Support\Collection;

View file

@ -1,8 +1,8 @@
<?php
namespace App\Tests\Talks;
namespace App\Tests\Talk;
use App\Talks\TwigExtension\TalksExtension;
use App\TwigExtension\Talk\TalksExtension;
use DateTime;
use PHPUnit\Framework\TestCase;
use Tightenco\Collect\Support\Collection;
@ -164,7 +164,7 @@ class RetrievingTalksTest extends TestCase
],
];
$talks = collect([$talkA, $talkB]);
$talks = new Collection([$talkA, $talkB]);
tap($this->extension->getAllEvents($talks), function (Collection $events) {
$this->assertCount(3, $events);