mirror of
https://github.com/janunger/rheinwerk-video-training.git
synced 2026-02-06 07:05:14 +01:00
Initiale Version
This commit is contained in:
7
Kapitel_10/Lektion_4/symfony/app/.htaccess
Executable file
7
Kapitel_10/Lektion_4/symfony/app/.htaccess
Executable file
@@ -0,0 +1,7 @@
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
7
Kapitel_10/Lektion_4/symfony/app/AppCache.php
Executable file
7
Kapitel_10/Lektion_4/symfony/app/AppCache.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
|
||||
|
||||
class AppCache extends HttpCache
|
||||
{
|
||||
}
|
||||
50
Kapitel_10/Lektion_4/symfony/app/AppKernel.php
Executable file
50
Kapitel_10/Lektion_4/symfony/app/AppKernel.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
{
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = [
|
||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||
new AppBundle\AppBundle(),
|
||||
];
|
||||
|
||||
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
|
||||
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
|
||||
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
|
||||
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
|
||||
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
|
||||
}
|
||||
|
||||
return $bundles;
|
||||
}
|
||||
|
||||
public function getRootDir()
|
||||
{
|
||||
return __DIR__;
|
||||
}
|
||||
|
||||
public function getCacheDir()
|
||||
{
|
||||
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
|
||||
}
|
||||
|
||||
public function getLogDir()
|
||||
{
|
||||
return dirname(__DIR__).'/var/logs';
|
||||
}
|
||||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
|
||||
}
|
||||
}
|
||||
13
Kapitel_10/Lektion_4/symfony/app/Resources/views/base.html.twig
Executable file
13
Kapitel_10/Lektion_4/symfony/app/Resources/views/base.html.twig
Executable file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
{% block stylesheets %}{% endblock %}
|
||||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
{% block javascripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
31
Kapitel_10/Lektion_4/symfony/app/Resources/views/cd/index.html.twig
Executable file
31
Kapitel_10/Lektion_4/symfony/app/Resources/views/cd/index.html.twig
Executable file
@@ -0,0 +1,31 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{{ cd.name }} ({{ cd.kuenstler.name }}, {{ cd.erscheinungsjahr }})</h1>
|
||||
|
||||
<form action="{{ path('lied-hinzufuegen', {"cdId": cd.id}) }}" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Track</th>
|
||||
<th>Titel</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% for lied in cd.lieder %}
|
||||
<tr>
|
||||
<td>{{ lied.track }}</td>
|
||||
<td>{{ lied.titel }}</td>
|
||||
<td><a href="{{ path('lied-bearbeiten', {'liedId': lied.id}) }}">Bearbeiten ...</a></td>
|
||||
<td><a href="{{ path('lied-loeschen', {'liedId': lied.id}) }}">Löschen ...</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td><input type="text" name="track" placeholder="Track"/></td>
|
||||
<td><input type="text" name="titel" placeholder="Titel"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" value="Hinzufügen"/>
|
||||
</form>
|
||||
|
||||
<p><a href="{{ path('homepage') }}">zur Übersicht</a></p>
|
||||
{% endblock %}
|
||||
20
Kapitel_10/Lektion_4/symfony/app/Resources/views/default/index.html.twig
Executable file
20
Kapitel_10/Lektion_4/symfony/app/Resources/views/default/index.html.twig
Executable file
@@ -0,0 +1,20 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>Künstler</th>
|
||||
<th>Album</th>
|
||||
<th>Erscheinungsjahr</th>
|
||||
</tr>
|
||||
{% for cd in cds %}
|
||||
<tr>
|
||||
<td>{{ cd.kuenstler.name }}</td>
|
||||
<td>
|
||||
<a href="{{ path('cd', {'cdId': cd.id}) }}">{{ cd.name }}</a>
|
||||
</td>
|
||||
<td>{{ cd.erscheinungsjahr }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
17
Kapitel_10/Lektion_4/symfony/app/Resources/views/lied/bearbeiten.html.twig
Executable file
17
Kapitel_10/Lektion_4/symfony/app/Resources/views/lied/bearbeiten.html.twig
Executable file
@@ -0,0 +1,17 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<form action="{{ path('lied-bearbeiten', {'liedId': lied.id}) }}" method="post">
|
||||
<h1>Lied bearbeiten</h1>
|
||||
<h2>'{{ lied.cd.name }}' ({{ lied.cd.kuenstler.name }})</h2>
|
||||
|
||||
<label>Track
|
||||
<input type="text" name="track" value="{{ lied.track }}"/>
|
||||
</label>
|
||||
<label>Titel
|
||||
<input type="text" name="titel" value="{{ lied.titel }}"/>
|
||||
</label>
|
||||
<button type="submit" name="aktion" value="speichern">Speichern</button>
|
||||
<button type="submit" name="aktion" value="abbrechen">Abbrechen</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
15
Kapitel_10/Lektion_4/symfony/app/Resources/views/lied/loeschen.html.twig
Executable file
15
Kapitel_10/Lektion_4/symfony/app/Resources/views/lied/loeschen.html.twig
Executable file
@@ -0,0 +1,15 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<form action="{{ path('lied-loeschen', {'liedId': lied.id}) }}" method="post">
|
||||
<h1>Lied löschen</h1>
|
||||
<h2>{{ lied.cd.name }} ({{ lied.cd.kuenstler.name }})</h2>
|
||||
|
||||
<p>
|
||||
Möchten Sie Track {{ lied.track }} '{{ lied.titel }}' löschen?<br>
|
||||
Diese Aktion kann nicht rückgängig gemacht werden.
|
||||
</p>
|
||||
<button type="submit" name="aktion" value="loeschen">Löschen!</button>
|
||||
<button type="submit" name="aktion" value="abbrechen">Abbrechen</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
13
Kapitel_10/Lektion_4/symfony/app/autoload.php
Executable file
13
Kapitel_10/Lektion_4/symfony/app/autoload.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
use Composer\Autoload\ClassLoader;
|
||||
|
||||
/**
|
||||
* @var ClassLoader $loader
|
||||
*/
|
||||
$loader = require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
|
||||
|
||||
return $loader;
|
||||
68
Kapitel_10/Lektion_4/symfony/app/config/config.yml
Executable file
68
Kapitel_10/Lektion_4/symfony/app/config/config.yml
Executable file
@@ -0,0 +1,68 @@
|
||||
imports:
|
||||
- { resource: parameters.yml }
|
||||
- { resource: security.yml }
|
||||
- { resource: services.yml }
|
||||
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||
parameters:
|
||||
locale: en
|
||||
|
||||
framework:
|
||||
#esi: ~
|
||||
#translator: { fallbacks: ["%locale%"] }
|
||||
secret: "%secret%"
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing.yml"
|
||||
strict_requirements: ~
|
||||
form: ~
|
||||
csrf_protection: ~
|
||||
validation: { enable_annotations: true }
|
||||
#serializer: { enable_annotations: true }
|
||||
templating:
|
||||
engines: ['twig']
|
||||
default_locale: "%locale%"
|
||||
trusted_hosts: ~
|
||||
trusted_proxies: ~
|
||||
session:
|
||||
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
|
||||
handler_id: session.handler.native_file
|
||||
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
||||
fragments: ~
|
||||
http_method_override: true
|
||||
assets: ~
|
||||
|
||||
# Twig Configuration
|
||||
twig:
|
||||
debug: "%kernel.debug%"
|
||||
strict_variables: "%kernel.debug%"
|
||||
|
||||
# Doctrine Configuration
|
||||
doctrine:
|
||||
dbal:
|
||||
driver: pdo_mysql
|
||||
host: "%database_host%"
|
||||
port: "%database_port%"
|
||||
dbname: "%database_name%"
|
||||
user: "%database_user%"
|
||||
password: "%database_password%"
|
||||
charset: UTF8
|
||||
# if using pdo_sqlite as your database driver:
|
||||
# 1. add the path in parameters.yml
|
||||
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
|
||||
# 2. Uncomment database_path in parameters.yml.dist
|
||||
# 3. Uncomment next line:
|
||||
# path: "%database_path%"
|
||||
|
||||
orm:
|
||||
auto_generate_proxy_classes: "%kernel.debug%"
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||
auto_mapping: true
|
||||
|
||||
# Swiftmailer Configuration
|
||||
swiftmailer:
|
||||
transport: "%mailer_transport%"
|
||||
host: "%mailer_host%"
|
||||
username: "%mailer_user%"
|
||||
password: "%mailer_password%"
|
||||
spool: { type: memory }
|
||||
34
Kapitel_10/Lektion_4/symfony/app/config/config_dev.yml
Executable file
34
Kapitel_10/Lektion_4/symfony/app/config/config_dev.yml
Executable file
@@ -0,0 +1,34 @@
|
||||
imports:
|
||||
- { resource: config.yml }
|
||||
|
||||
framework:
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing_dev.yml"
|
||||
strict_requirements: true
|
||||
profiler: { only_exceptions: false }
|
||||
|
||||
web_profiler:
|
||||
toolbar: true
|
||||
intercept_redirects: false
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: [!event]
|
||||
console:
|
||||
type: console
|
||||
channels: [!event, !doctrine]
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
# type: firephp
|
||||
# level: info
|
||||
#chromephp:
|
||||
# type: chromephp
|
||||
# level: info
|
||||
|
||||
#swiftmailer:
|
||||
# delivery_address: me@example.com
|
||||
21
Kapitel_10/Lektion_4/symfony/app/config/config_prod.yml
Executable file
21
Kapitel_10/Lektion_4/symfony/app/config/config_prod.yml
Executable file
@@ -0,0 +1,21 @@
|
||||
imports:
|
||||
- { resource: config.yml }
|
||||
|
||||
#doctrine:
|
||||
# orm:
|
||||
# metadata_cache_driver: apc
|
||||
# result_cache_driver: apc
|
||||
# query_cache_driver: apc
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
nested:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
console:
|
||||
type: console
|
||||
16
Kapitel_10/Lektion_4/symfony/app/config/config_test.yml
Executable file
16
Kapitel_10/Lektion_4/symfony/app/config/config_test.yml
Executable file
@@ -0,0 +1,16 @@
|
||||
imports:
|
||||
- { resource: config_dev.yml }
|
||||
|
||||
framework:
|
||||
test: ~
|
||||
session:
|
||||
storage_id: session.storage.mock_file
|
||||
profiler:
|
||||
collect: false
|
||||
|
||||
web_profiler:
|
||||
toolbar: false
|
||||
intercept_redirects: false
|
||||
|
||||
swiftmailer:
|
||||
disable_delivery: true
|
||||
12
Kapitel_10/Lektion_4/symfony/app/config/parameters.yml
Executable file
12
Kapitel_10/Lektion_4/symfony/app/config/parameters.yml
Executable file
@@ -0,0 +1,12 @@
|
||||
# This file is auto-generated during the composer install
|
||||
parameters:
|
||||
database_host: 127.0.0.1
|
||||
database_port: null
|
||||
database_name: mediathek
|
||||
database_user: root
|
||||
database_password: root
|
||||
mailer_transport: smtp
|
||||
mailer_host: 127.0.0.1
|
||||
mailer_user: null
|
||||
mailer_password: null
|
||||
secret: b661db55815724f28aadff82e61e5edf8d936aac
|
||||
19
Kapitel_10/Lektion_4/symfony/app/config/parameters.yml.dist
Executable file
19
Kapitel_10/Lektion_4/symfony/app/config/parameters.yml.dist
Executable file
@@ -0,0 +1,19 @@
|
||||
# This file is a "template" of what your parameters.yml file should look like
|
||||
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
|
||||
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
|
||||
parameters:
|
||||
database_host: 127.0.0.1
|
||||
database_port: ~
|
||||
database_name: symfony
|
||||
database_user: root
|
||||
database_password: ~
|
||||
# You should uncomment this if you want use pdo_sqlite
|
||||
# database_path: "%kernel.root_dir%/data.db3"
|
||||
|
||||
mailer_transport: smtp
|
||||
mailer_host: 127.0.0.1
|
||||
mailer_user: ~
|
||||
mailer_password: ~
|
||||
|
||||
# A secret key that's used to generate certain security-related tokens
|
||||
secret: ThisTokenIsNotSoSecretChangeIt
|
||||
3
Kapitel_10/Lektion_4/symfony/app/config/routing.yml
Executable file
3
Kapitel_10/Lektion_4/symfony/app/config/routing.yml
Executable file
@@ -0,0 +1,3 @@
|
||||
app:
|
||||
resource: "@AppBundle/Controller/"
|
||||
type: annotation
|
||||
14
Kapitel_10/Lektion_4/symfony/app/config/routing_dev.yml
Executable file
14
Kapitel_10/Lektion_4/symfony/app/config/routing_dev.yml
Executable file
@@ -0,0 +1,14 @@
|
||||
_wdt:
|
||||
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
|
||||
prefix: /_wdt
|
||||
|
||||
_profiler:
|
||||
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
|
||||
prefix: /_profiler
|
||||
|
||||
_errors:
|
||||
resource: "@TwigBundle/Resources/config/routing/errors.xml"
|
||||
prefix: /_error
|
||||
|
||||
_main:
|
||||
resource: routing.yml
|
||||
24
Kapitel_10/Lektion_4/symfony/app/config/security.yml
Executable file
24
Kapitel_10/Lektion_4/symfony/app/config/security.yml
Executable file
@@ -0,0 +1,24 @@
|
||||
# To get started with security, check out the documentation:
|
||||
# http://symfony.com/doc/current/book/security.html
|
||||
security:
|
||||
|
||||
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
|
||||
providers:
|
||||
in_memory:
|
||||
memory: ~
|
||||
|
||||
firewalls:
|
||||
# disables authentication for assets and the profiler, adapt it according to your needs
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
|
||||
main:
|
||||
anonymous: ~
|
||||
# activate different ways to authenticate
|
||||
|
||||
# http_basic: ~
|
||||
# http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
|
||||
|
||||
# form_login: ~
|
||||
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
|
||||
9
Kapitel_10/Lektion_4/symfony/app/config/services.yml
Executable file
9
Kapitel_10/Lektion_4/symfony/app/config/services.yml
Executable file
@@ -0,0 +1,9 @@
|
||||
# Learn more about services, parameters and containers at
|
||||
# http://symfony.com/doc/current/book/service_container.html
|
||||
parameters:
|
||||
# parameter_name: value
|
||||
|
||||
services:
|
||||
# service_name:
|
||||
# class: AppBundle\Directory\ClassName
|
||||
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]
|
||||
Reference in New Issue
Block a user