Question

I am new to symfony2 and and now i have installed Sonata Admin bundle. I am reading their documentaion but its not clear what should i do after installing it.

How should i start. I mean there is no example where i can start learning how to use that bundle. Can anyone please help me with this

Was it helpful?

Solution

Follow this installation instruction: http://sonata-project.org/bundles/admin/master/doc/reference/installation.html Then you have to create a new Admin class that references an existing entity class of your bundle: http://sonata-project.org/bundles/admin/master/doc/reference/getting-started.html

Please add more specific question if you want further support, thanks!

-- EDIT:

You can declare it wherever you want. Just notice that it has to extend base Admin class and must be a service tagged with 'sonata.admin'. IE:

namespace Acme\FooBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;

class FooAdmin extends Admin
{
}

and in services.xml of your bundle you have to add the declaration of the service:

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="sonata.admin.foo" class="Acme\FooBundle\Admin\FooAdmin">
            <tag name="sonata.admin" manager_type="orm" group="Foos" label="Foo"/>
            <argument />
            <argument>Acme\FooBundle\Entity\Foo</argument>
            <argument>SonataAdminBundle:CRUD</argument>
        </service>
    </services>
</container>

Whenever you have the class and the declaration, if your setup is correct, you will see the new link in the Admin Dashboard of Sonata (it should be at the url /admin).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top