Propel init

This commit is contained in:
Simon Vieille 2016-02-20 19:14:23 +01:00
parent c67bc1c50f
commit 8a037f95e9
16 changed files with 94 additions and 51 deletions

20
.gitignore vendored Normal file
View file

@ -0,0 +1,20 @@
/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/tags
Base
Map
/app/propel/

View file

@ -15,7 +15,8 @@ class AppKernel extends Kernel
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Propel\Bundle\PropelBundle\PropelBundle(),
new NotifyBundle\NotifyBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

View file

@ -2,6 +2,7 @@ imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: "@NotifyBundle/Resources/config/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
@ -38,27 +39,17 @@ 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
propel:
generator:
objectModel:
addClassLevelComment: false
database:
connections:
default:
adapter: %database_driver%
user: %database_user%
password: %database_password%
dsn: %database_driver%:host=%database_host%;dbname=%database_name%;charset=%database_charset%
# Swiftmailer Configuration
swiftmailer:

View file

@ -31,5 +31,5 @@ monolog:
# type: chromephp
# level: info
#swiftmailer:
# delivery_address: me@example.com
swiftmailer:
delivery_address: dev@deblan.fr

View file

@ -6,6 +6,8 @@ parameters:
database_port: ~
database_name: symfony
database_user: root
database_driver: mysql
database_charset: UTF8
database_password: ~
# You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3"

View file

@ -1,3 +1,8 @@
notify:
resource: "@NotifyBundle/Controller/"
type: annotation
prefix: /
app:
resource: "@AppBundle/Controller/"
type: annotation

View file

@ -7,7 +7,7 @@ $lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo_title('Symfony2 Requirements Checker');
echo_title('Symfony Requirements Checker');
echo '> PHP is using the following php.ini file:'.PHP_EOL;
if ($iniPath) {
@ -43,9 +43,9 @@ foreach ($symfonyRequirements->getRecommendations() as $req) {
}
if ($checkPassed) {
echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects');
echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
} else {
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects');
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
echo_title('Fix the following mandatory requirements', 'red');

View file

@ -26,7 +26,10 @@
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0"
"incenteev/composer-parameter-handler": "^2.0",
"symfony/dom-crawler": "^3.0",
"propel/propel": "dev-master",
"propel/propel-bundle": "2.0.x-dev"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",

View file

@ -1,21 +0,0 @@
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
]);
}
}

Binary file not shown.

View file

@ -0,0 +1,17 @@
<?php
namespace NotifyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class DefaultController extends Controller
{
/**
* @Route("/")
*/
public function indexAction()
{
return $this->render('NotifyBundle:Default:index.html.twig');
}
}

View file

@ -1,9 +1,9 @@
<?php
namespace AppBundle;
namespace NotifyBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
class NotifyBundle extends Bundle
{
}

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="default" namespace="NotifyBundle\Model">
</database>

View file

@ -0,0 +1,4 @@
services:
# notify.example:
# class: NotifyBundle\Example
# arguments: ["@service_id", "plain_value", %parameter%]

View file

@ -0,0 +1 @@
Hello World!

View file

@ -0,0 +1,17 @@
<?php
namespace NotifyBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$this->assertContains('Hello World', $client->getResponse()->getContent());
}
}