Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hw16 andrey lukashenko #7

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/node_modules/
/bower_components/
/web/fonts/
/web/css/
/web/images/
/web/js/
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Geekhub PHP HomeWork#16: Symfony Vocabulary Application - Tests
=

####EER Diagram:

https://docs.google.com/drawings/d/1gXIQH6vCcoeqFa2ess2fpVgOADpIkfmPAOGW7HD2LCs/edit?usp=sharing

####Setup:

Setup database in "app/config/parameters.yml".

Note: Before continue, install Node.js.<br>
Note 2: "composer install" runs commands "npm i" and "./node_modules/.bin/bower install"

```bash
$ git clone -b hw16-andrey-lukashenko https://github.com/AndreyLuka/geekhub-php-vocabulary.git
$ cd geekhub-php-vocabulary
$ composer install
$ php bin/console doctrine:database:create
$ php bin/console doctrine:schema:create
$ php bin/console doctrine:fixtures:load
```

####Default users:
login: admin<br>
password: admin

login: user<br>
password: user

Homework 14: Vocabulary
==========

Expand Down
4 changes: 4 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ public function registerBundles()
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
];

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();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}

return $bundles;
Expand Down
31 changes: 30 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ framework:
assets: ~
php_errors:
log: true
translator: { fallbacks: [en] }
default_locale: en

# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
form_themes:
- bootstrap_3_layout.html.twig

# Doctrine Configuration
doctrine:
Expand All @@ -48,7 +52,10 @@ doctrine:
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
charset: utf8
default_table_options:
charset: utf8
collate: utf8_general_ci
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/../var/data/data.sqlite"
Expand All @@ -68,3 +75,25 @@ swiftmailer:
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }

knp_doctrine_behaviors:
translatable: true
timestampable: true

a2lix_translation_form:
locale_provider: default
locales: [en, uk, ru, fr, es]
default_locale: en
required_locales: [en]
templating: "A2lixTranslationFormBundle::default.html.twig"

knp_paginator:
page_range: 5 # default page range used in pagination control
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
sort_direction_name: direction # sort direction query parameter name
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
template:
pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig # sliding pagination controls template
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template
5 changes: 5 additions & 0 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ web_profiler:

swiftmailer:
disable_delivery: true

security:
firewalls:
main:
http_basic: ~
3 changes: 3 additions & 0 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
app:
resource: "@AppBundle/Controller/"
type: annotation
prefix: /{_locale}
requirements:
_locale: "|en|uk|ru|fr|es"
22 changes: 22 additions & 0 deletions app/config/security.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
encoders:
AppBundle\Entity\User:
algorithm: bcrypt

# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
in_memory:
memory: ~

app_db_provider:
entity:
class: AppBundle:User
property: username

firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
Expand All @@ -22,3 +30,17 @@ security:

# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html

form_login:
login_path: login
check_path: login
logout:
path: logout
target: login
provider: app_db_provider

role_hierarchy:
ROLE_ADMIN: [ROLE_USER]

access_control:
- { path: ^/words/[0-9]+, roles: [ROLE_USER] }
13 changes: 13 additions & 0 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ services:
# service_name:
# class: AppBundle\Directory\ClassName
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]

app.app_voter:
class: AppBundle\Security\AppVoter
arguments: ['@security.access.decision_manager']
public: false
tags:
- { name: security.voter }

app.twig_extension:
class: AppBundle\Twig\AppExtension
public: false
tags:
- { name: twig.extension }
22 changes: 22 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "geekhub-php-vocabulary",
"description": "Geekhub PHP HomeWork: Symfony vocabulary Application",
"main": "index.js",
"authors": [
"Andrey Lukashenko"
],
"license": "MIT",
"homepage": "https://github.com/AndreyLuka/geekhub-php-vocabulary",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap": "^3.3.7",
"html5shiv": "^3.7.3",
"respond": "Respond#^1.4.2"
}
}
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0"
"incenteev/composer-parameter-handler": "^2.0",
"knplabs/knp-paginator-bundle": "^2.5",
"knplabs/doctrine-behaviors": "~1.1",
"a2lix/translation-form-bundle": "^2.1"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
"symfony/phpunit-bridge": "^3.0",
"nelmio/alice": "2.1.4",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"phpunit/phpunit": "5.7.9"
},
"scripts": {
"symfony-scripts": [
Expand All @@ -43,7 +49,9 @@
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
"@symfony-scripts",
"npm i",
"./node_modules/.bin/bower install"
],
"post-update-cmd": [
"@symfony-scripts"
Expand Down
Loading