Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

EricReiche/SonataNewsBundle

 
 

Repository files navigation

SonataNewsBundle

A blog platform based on Doctrine2 (ORM and MongoDB) and Symfony2.

The online documentation of the bundle is in http://sonata-project.org/bundles/news

For contribution to the documentation you cand find it on Resources/doc

Warning: documentation files are not rendering correctly in Github (reStructuredText format) and some content might be broken or hidden, make sure to read raw files.

Google Groups: For questions and proposals you can post on this google groups

With Symfony v2.0.4

Clear cache before !! rm app/cache/* -rf !!

Add to app/deps

[symfony]
    git=http://github.com/symfony/symfony.git
    version=v2.0.4
...

[FOSUserBundle]
    git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
    target=/bundles/FOS/UserBundle

[SonataNewsBundle]
    [email protected]:sonata-project/SonataNewsBundle.git
    target=/bundles/Sonata/NewsBundle

[SonataMediaBundle]
    [email protected]:sonata-project/SonataMediaBundle.git
    target=/bundles/Sonata/MediaBundle

[SonataUserBundle]
    git=https://github.com/sonata-project/SonataUserBundle.git
    target=/bundles/Sonata/UserBundle

[SonataAdminBundle]
    [email protected]:sonata-project/SonataAdminBundle.git
    target=/bundles/Sonata/AdminBundle

[SonataFormatterBundle]
    git=http://github.com/sonata-project/SonataFormatterBundle.git
    target=/bundles/Sonata/FormatterBundle

[SonataIntlBundle]
    git=https://github.com/sonata-project/SonataIntlBundle
    target=/bundles/Sonata/IntlBundle

[KnpMarkdownBundle]
    git=http://github.com/KnpLabs/KnpMarkdownBundle.git
    target=/bundles/Knp/Bundle/MarkdownBundle

[KnpMenu]
    git=https://github.com/Knplabs/KnpMenu.git
    target=/knp/menu

[gaufrette]
    git=https://github.com/sonata-project/Gaufrette.git
    target=/gaufrette

[imagine]
    git=https://github.com/avalanche123/Imagine.git
    target=/imagine

Let a empty line to the end of file deps

Make a "php bin/vendors install"

If you have some errors after this action, install vendor folder from http://symfony.com/download

Add this to app/autoload.php

..
    $loader->registerNamespaces(array(
        ...
        'FOS'              => __DIR__.'/../vendor/bundles',
        'Knp' => array(
            __DIR__.'/../vendor/bundles',
            __DIR__.'/../vendor/knp/menu/src'
        ),
        'Sonata'           => __DIR__.'/../vendor/bundles',
        'Gaufrette' => __DIR__.'/../vendor/gaufrette/src',
        'Imagine' => __DIR__.'/../vendor/imagine/lib',
    ...

Add to app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
.../*Vendor Sonata*/
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\NewsBundle\SonataNewsBundle(),
            new Sonata\UserBundle\SonataUserBundle(),
            new Sonata\MediaBundle\SonataMediaBundle(),
            new Sonata\FormatterBundle\SonataFormatterBundle(),

            new FOS\UserBundle\FOSUserBundle(),
            new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),

            /*Application Sonata*/
            new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
            new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
            new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
...
)};

Add to app/config/config.yml

imports:
    - { resource: parameters.ini }
    - { resource: security.yml }
    - { resource: sonata_news.yml }
    - { resource: sonata_media.yml }
    - { resource: fos_user.yml }

Create 3 new files: - app/config/fos_user.yml - app/config/sonata_media.yml - app/config/sonata_news.yml

Add to fos_user.yml

fos_user:
  db_driver: orm # can be orm or odm
  firewall_name: main
  user_class: Application\Sonata\UserBundle\Entity\User
  group:
    group_class: Application\Sonata\UserBundle\Entity\Group
doctrine:
  orm:
    entity_managers:
      default:
        mappings:
          FOSUserBundle: ~
          ApplicationSonataUserBundle: ~
          SonataUserBundle: ~

Add to sonata_media.yml

sonata_media:
  db_driver: doctrine_orm
  contexts:
    default: # the default context is mandatory
      providers:
        - sonata.media.provider.dailymotion
        - sonata.media.provider.youtube
        - sonata.media.provider.image
        - sonata.media.provider.file
        - sonata.media.provider.vimeo
      formats:
        small: { width: 100 , quality: 70}
        big: { width: 500 , quality: 70}
  cdn:
    sonata.media.cdn.server:
      path: /uploads/media # http://media.sonata-project.org/
  filesystem:
    sonata.media.adapter.filesystem.local:
      directory: %kernel.root_dir%/../web/uploads/media
      create: true
  providers:
    sonata.media.provider.file:
      resizer: false
doctrine:
  orm:
    entity_managers:
      default:
        mappings:
          ApplicationSonataMediaBundle: ~
          SonataMediaBundle: ~

Add to sonata_news.yml

sonata_news:
  title:        "Mon titre"
  link:         http://sonata-project.org
  description:  Cool bundles on top of Symfony2
doctrine:
  orm:
    entity_managers:
      default:
        #metadata_cache_driver: apc
        #query_cache_driver: apc
        #result_cache_driver: apc
        mappings:
          ApplicationSonataNewsBundle: ~
          SonataNewsBundle: ~

Create in src/application/Sonata ../MediaBundle/ApplicationSonataMediaBundle.php

<?php
namespace Application\Sonata\MediaBundle;

    use Symfony\Component\HttpKernel\Bundle\Bundle;

    class ApplicationSonataMediaBundle extends Bundle
    {
    }
?>

../NewsBundle

<?php
namespace Application\Sonata\NewsBundle;

    use Symfony\Component\HttpKernel\Bundle\Bundle;

    class ApplicationSonataNewsBundle extends Bundle
    {
    }
?>

../UserBundle/

<?php
namespace Application\Sonata\UserBundle;

    use Symfony\Component\HttpKernel\Bundle\Bundle;

    class ApplicationSonataUserBundle extends Bundle
    {
    }
?>

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%