diff --git a/app/AppKernel.php b/app/AppKernel.php index c5c9eb6b2f..61dfcaf87f 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -8,6 +8,7 @@ class AppKernel extends Kernel public function registerBundles() { $bundles = array( + // Symfony Standard Edition Bundles new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), @@ -16,6 +17,19 @@ public function registerBundles() new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), + + // Symfony CMF Standard Edition Bundles + new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(), + new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(), + new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(), + new Symfony\Cmf\Bundle\SimpleCmsBundle\CmfSimpleCmsBundle(), + + new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(), + new Knp\Bundle\MenuBundle\KnpMenuBundle(), + + new Symfony\Cmf\Bundle\CreateBundle\CmfCreateBundle(), + new FOS\RestBundle\FOSRestBundle(), + new JMS\SerializerBundle\JMSSerializerBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/app.sqlite b/app/app.sqlite new file mode 100644 index 0000000000..21e73f898c Binary files /dev/null and b/app/app.sqlite differ diff --git a/app/config/config.yml b/app/config/config.yml index fcfde1a6ee..ccd4f2b09c 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -42,23 +42,43 @@ assetic: #yui_css: # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" -# Doctrine Configuration +# Doctrine Configuration (needed for Jackalope Doctrine DBAL) doctrine: dbal: driver: "%database_driver%" - 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, add the path in parameters.yml - # e.g. database_path: "%kernel.root_dir%/data/data.db3" - # path: "%database_path%" + path: "%database_path%" + # if using something else than pdo_sqlite as driver, add the + # parameters in parameters.yml.dist and uncomment the lines below + #host: "%database_host%" + #port: "%database_port%" + #dbname: "%database_name%" + #user: "%database_user%" + #password: "%database_password%" - orm: - auto_generate_proxy_classes: "%kernel.debug%" +# Doctrine PHPCR-ODM configuration +doctrine_phpcr: + session: + backend: "%phpcr_backend%" + workspace: "%phpcr_workspace%" + username: "%phpcr_user%" + password: "%phpcr_password%" + odm: auto_mapping: true + auto_generate_proxy_classes: "%kernel.debug%" + +# Cmf Configuration +cmf_core: + persistence: + phpcr: true + # if you want another basepath + # basepath: /custom/basepath + publish_workflow: false + +cmf_simple_cms: + routing: + templates_by_class: + Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page: AcmeDemoBundle:Page:index.html.twig # Swiftmailer Configuration swiftmailer: diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 914c34ae22..a724592dff 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -17,9 +17,6 @@ monolog: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug - console: - type: console - bubble: false # uncomment to get logging in your browser # you may have to allow bigger header sizes in your Web server configuration #firephp: diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 342837a031..a835d60a3a 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -21,5 +21,3 @@ monolog: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug - console: - type: console diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 8b317c27d2..fb754d5099 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -1,10 +1,14 @@ parameters: database_driver: pdo_mysql - database_host: 127.0.0.1 - database_port: ~ - database_name: symfony - database_user: root - database_password: ~ + database_path: "%kernel.root_dir%/app.sqlite" + + phpcr_backend: + # use Jackalope Doctrine DBAL + type: doctrinedbal + connection: default + phpcr_workspace: default + phpcr_user: admin + phpcr_password: admin mailer_transport: smtp mailer_host: 127.0.0.1 diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml index c45f361bdb..ff93a02ba0 100644 --- a/app/config/routing_dev.yml +++ b/app/config/routing_dev.yml @@ -12,7 +12,3 @@ _configurator: _main: resource: routing.yml - -# AcmeDemoBundle routes (to be removed) -_acme_demo: - resource: "@AcmeDemoBundle/Resources/config/routing.yml" diff --git a/composer.json b/composer.json index dad465b151..96340799f8 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,31 @@ { - "name": "symfony/framework-standard-edition", + "name": "symfony-cmf/standard-edition", "license": "MIT", "type": "project", - "description": "The \"Symfony Standard Edition\" distribution", + "description": "The \"Symfony CMF Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", - "symfony/symfony": "~2.4", - "doctrine/orm": "~2.2,>=2.2.3", - "doctrine/doctrine-bundle": "~1.2", - "twig/extensions": "~1.0", - "symfony/assetic-bundle": "~2.3", - "symfony/swiftmailer-bundle": "~2.3", - "symfony/monolog-bundle": "~2.4", - "sensio/distribution-bundle": "~2.3", - "sensio/framework-extra-bundle": "~3.0", - "sensio/generator-bundle": "~2.3", - "incenteev/composer-parameter-handler": "~2.0" + "symfony/symfony": "2.3.*", + "jackalope/jackalope-doctrine-dbal": "1.1.*", + "doctrine/doctrine-bundle": "1.2.*", + "doctrine/data-fixtures": "1.0.*", + "twig/extensions": "1.0.*", + "symfony/assetic-bundle": "2.3.*", + "symfony/swiftmailer-bundle": "2.3.*", + "symfony/monolog-bundle": "2.3.*", + "symfony-cmf/symfony-cmf": "1.1.*", + "symfony-cmf/simple-cms-bundle": "1.1.*", + "symfony-cmf/create-bundle": "1.1.*", + "sensio/distribution-bundle": "2.3.*", + "sensio/framework-extra-bundle": "2.3.*", + "sensio/generator-bundle": "2.3.*", + "incenteev/composer-parameter-handler": "~2.0", + "nelmio/alice": "1.*" }, + "minimum-stability": "dev", "scripts": { "post-install-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", @@ -46,7 +52,7 @@ "file": "app/config/parameters.yml" }, "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "1.1-dev" } } } diff --git a/src/Acme/DemoBundle/Command/HelloWorldCommand.php b/src/Acme/DemoBundle/Command/HelloWorldCommand.php deleted file mode 100644 index 998cbcdf24..0000000000 --- a/src/Acme/DemoBundle/Command/HelloWorldCommand.php +++ /dev/null @@ -1,48 +0,0 @@ -getContainer(). - * - * @author Tobias Schultze - */ -class HelloWorldCommand extends Command -{ - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('acme:hello') - ->setDescription('Hello World example command') - ->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World') - ->setHelp(<<%command.name% command greets somebody or everybody: - -php %command.full_name% - -The optional argument specifies who to greet: - -php %command.full_name% Fabien -EOF - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $output->writeln(sprintf('Hello %s!', $input->getArgument('who'))); - } -} diff --git a/src/Acme/DemoBundle/Controller/DemoController.php b/src/Acme/DemoBundle/Controller/DemoController.php deleted file mode 100644 index a99de891ad..0000000000 --- a/src/Acme/DemoBundle/Controller/DemoController.php +++ /dev/null @@ -1,56 +0,0 @@ - $name); - } - - /** - * @Route("/contact", name="_demo_contact") - * @Template() - */ - public function contactAction(Request $request) - { - $form = $this->createForm(new ContactType()); - $form->handleRequest($request); - - if ($form->isValid()) { - $mailer = $this->get('mailer'); - - // .. setup a message and send it - // http://symfony.com/doc/current/cookbook/email.html - - $request->getSession()->getFlashBag()->set('notice', 'Message sent!'); - - return new RedirectResponse($this->generateUrl('_demo')); - } - - return array('form' => $form->createView()); - } -} diff --git a/src/Acme/DemoBundle/Controller/SecuredController.php b/src/Acme/DemoBundle/Controller/SecuredController.php deleted file mode 100644 index 004fe958cb..0000000000 --- a/src/Acme/DemoBundle/Controller/SecuredController.php +++ /dev/null @@ -1,70 +0,0 @@ -attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { - $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); - } else { - $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); - } - - return array( - 'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME), - 'error' => $error, - ); - } - - /** - * @Route("/login_check", name="_security_check") - */ - public function securityCheckAction() - { - // The security layer will intercept this request - } - - /** - * @Route("/logout", name="_demo_logout") - */ - public function logoutAction() - { - // The security layer will intercept this request - } - - /** - * @Route("/hello", defaults={"name"="World"}), - * @Route("/hello/{name}", name="_demo_secured_hello") - * @Template() - */ - public function helloAction($name) - { - return array('name' => $name); - } - - /** - * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin") - * @Security("is_granted('ROLE_ADMIN')") - * @Template() - */ - public function helloadminAction($name) - { - return array('name' => $name); - } -} diff --git a/src/Acme/DemoBundle/Controller/WelcomeController.php b/src/Acme/DemoBundle/Controller/WelcomeController.php deleted file mode 100644 index acceedfd90..0000000000 --- a/src/Acme/DemoBundle/Controller/WelcomeController.php +++ /dev/null @@ -1,18 +0,0 @@ -render('AcmeDemoBundle:Welcome:index.html.twig'); - } -} diff --git a/src/Acme/DemoBundle/DataFixtures/PHPCR/LoadPageData.php b/src/Acme/DemoBundle/DataFixtures/PHPCR/LoadPageData.php new file mode 100644 index 0000000000..6d99d77132 --- /dev/null +++ b/src/Acme/DemoBundle/DataFixtures/PHPCR/LoadPageData.php @@ -0,0 +1,24 @@ +load('services.xml'); - } - - public function getAlias() - { - return 'acme_demo'; - } -} diff --git a/src/Acme/DemoBundle/EventListener/ControllerListener.php b/src/Acme/DemoBundle/EventListener/ControllerListener.php deleted file mode 100644 index aa117d7426..0000000000 --- a/src/Acme/DemoBundle/EventListener/ControllerListener.php +++ /dev/null @@ -1,24 +0,0 @@ -extension = $extension; - } - - public function onKernelController(FilterControllerEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->extension->setController($event->getController()); - } - } -} diff --git a/src/Acme/DemoBundle/Form/ContactType.php b/src/Acme/DemoBundle/Form/ContactType.php deleted file mode 100644 index 2c76cdb27e..0000000000 --- a/src/Acme/DemoBundle/Form/ContactType.php +++ /dev/null @@ -1,20 +0,0 @@ -add('email', 'email'); - $builder->add('message', 'textarea'); - } - - public function getName() - { - return 'contact'; - } -} diff --git a/src/Acme/DemoBundle/Resources/config/routing.yml b/src/Acme/DemoBundle/Resources/config/routing.yml deleted file mode 100644 index 3402ca17cf..0000000000 --- a/src/Acme/DemoBundle/Resources/config/routing.yml +++ /dev/null @@ -1,12 +0,0 @@ -_welcome: - pattern: / - defaults: { _controller: AcmeDemoBundle:Welcome:index } - -_demo_secured: - resource: "@AcmeDemoBundle/Controller/SecuredController.php" - type: annotation - -_demo: - resource: "@AcmeDemoBundle/Controller/DemoController.php" - type: annotation - prefix: /demo \ No newline at end of file diff --git a/src/Acme/DemoBundle/Resources/config/services.xml b/src/Acme/DemoBundle/Resources/config/services.xml deleted file mode 100644 index d6274ce90e..0000000000 --- a/src/Acme/DemoBundle/Resources/config/services.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/Acme/DemoBundle/Resources/data/pages.yml b/src/Acme/DemoBundle/Resources/data/pages.yml new file mode 100644 index 0000000000..1f13ac088c --- /dev/null +++ b/src/Acme/DemoBundle/Resources/data/pages.yml @@ -0,0 +1,6 @@ +Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page: + demo: + id: /cms/simple/demo + label: Demo + title: CMF Demo + body: Hello! This page is created by the Symfony CMF. diff --git a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig deleted file mode 100644 index e5b7523bac..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Symfony - Contact form" %} - -{% block content %} -
- {{ form_errors(form) }} - - {{ form_row(form.email) }} - {{ form_row(form.message) }} - - {{ form_rest(form) }} - -
-{% endblock %} diff --git a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig deleted file mode 100644 index 3997ff606a..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }}!

-{% endblock %} - -{% set code = code(_self) %} diff --git a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig deleted file mode 100644 index 454a3203e4..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Symfony - Demos" %} - -{% block content_header '' %} - -{% block content %} -

Available demos

- -{% endblock %} diff --git a/src/Acme/DemoBundle/Resources/views/Page/index.html.twig b/src/Acme/DemoBundle/Resources/views/Page/index.html.twig new file mode 100644 index 0000000000..58a26f68e4 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Page/index.html.twig @@ -0,0 +1,3 @@ +

{{ cmfMainContent.title }}

+ +

{{ cmfMainContent.body }}

diff --git a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig deleted file mode 100644 index faf95cf8c1..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "AcmeDemoBundle:Secured:layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }}!

- - Hello resource secured for admin only. -{% endblock %} - -{% set code = code(_self) %} diff --git a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig deleted file mode 100644 index 4e3649f77a..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "AcmeDemoBundle:Secured:layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }} secured for Admins only!

-{% endblock %} - -{% set code = code(_self) %} diff --git a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig deleted file mode 100644 index aeea55c5cf..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block content_header_more %} - {{ parent() }} -
  • logged in as {{ app.user ? app.user.username : 'Anonymous' }} - Logout
  • -{% endblock %} diff --git a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig deleted file mode 100644 index e74a5aa7b6..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{% extends 'AcmeDemoBundle::layout.html.twig' %} - -{% block content %} -

    Login

    - -

    - Choose between two default users: user/userpass (ROLE_USER) or admin/adminpass (ROLE_ADMIN) -

    - - {% if error %} -
    {{ error.message }}
    - {% endif %} - -
    -
    - - -
    - -
    - - -
    - - -
    -{% endblock %} - -{% set code = code(_self) %} diff --git a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig b/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig deleted file mode 100644 index ea3a7299b7..0000000000 --- a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig +++ /dev/null @@ -1,83 +0,0 @@ -{% extends 'AcmeDemoBundle::layout.html.twig' %} - -{% block title %}Symfony - Welcome{% endblock %} - -{% block content_header '' %} - -{% block content %} - {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%} - -

    Welcome!

    - -

    Congratulations! You have successfully installed a new Symfony application.

    - -
    - - {% if app.environment == 'dev' %} - - {% endif %} - -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -{% endblock %} diff --git a/src/Acme/DemoBundle/Resources/views/layout.html.twig b/src/Acme/DemoBundle/Resources/views/layout.html.twig deleted file mode 100644 index d7e97d5638..0000000000 --- a/src/Acme/DemoBundle/Resources/views/layout.html.twig +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "TwigBundle::layout.html.twig" %} - -{% block head %} - - -{% endblock %} - -{% block title 'Demo Bundle' %} - -{% block body %} - {% for flashMessage in app.session.flashbag.get('notice') %} -
    - Notice: {{ flashMessage }} -
    - {% endfor %} - - {% block content_header %} - - -
    - {% endblock %} - -
    - {% block content %}{% endblock %} -
    - - {% if code is defined %} -

    Code behind this page

    -
    -
    {{ code|raw }}
    -
    - {% endif %} -{% endblock %} diff --git a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php b/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php deleted file mode 100644 index d217689754..0000000000 --- a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php +++ /dev/null @@ -1,45 +0,0 @@ -request('GET', '/demo/hello/Fabien'); - - $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count()); - } - - public function testSecureSection() - { - $client = static::createClient(); - - // goes to the secure page - $crawler = $client->request('GET', '/demo/secured/hello/World'); - - // redirects to the login page - $crawler = $client->followRedirect(); - - // submits the login form - $form = $crawler->selectButton('Login')->form(array('_username' => 'admin', '_password' => 'adminpass')); - $client->submit($form); - - // redirect to the original page (but now authenticated) - $crawler = $client->followRedirect(); - - // check that the page is the right one - $this->assertCount(1, $crawler->filter('h1.title:contains("Hello World!")')); - - // click on the secure link - $link = $crawler->selectLink('Hello resource secured')->link(); - $crawler = $client->click($link); - - // check that the page is the right one - $this->assertCount(1, $crawler->filter('h1.title:contains("secured for Admins only!")')); - } -} diff --git a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php b/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php deleted file mode 100644 index def07573dd..0000000000 --- a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php +++ /dev/null @@ -1,81 +0,0 @@ -loader = $loader; - } - - public function setController($controller) - { - $this->controller = $controller; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))), - ); - } - - public function getCode($template) - { - // highlight_string highlights php code only if 'getControllerCode(), true); - $controller = str_replace('<?php    ', '    ', $controller); - - $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8'); - - // remove the code block - $template = str_replace('{% set code = code(_self) %}', '', $template); - - return <<Controller Code

    -
    $controller
    - -

    Template Code

    -
    $template
    -EOF; - } - - protected function getControllerCode() - { - $class = get_class($this->controller[0]); - if (class_exists('CG\Core\ClassUtils')) { - $class = ClassUtils::getUserClass($class); - } - - $r = new \ReflectionClass($class); - $m = $r->getMethod($this->controller[1]); - - $code = file($r->getFilename()); - - return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1)); - } - - protected function getTemplateCode($template) - { - return $this->loader->getSource($template->getTemplateName()); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'demo'; - } -}