Skip to content

Instantly share code, notes, and snippets.

@rande
Created February 4, 2011 12:40
Show Gist options
  • Save rande/811066 to your computer and use it in GitHub Desktop.
Save rande/811066 to your computer and use it in GitHub Desktop.
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\BaseApplicationBundle\Admin;
abstract class EntityAdmin extends Admin
{
/**
* return the entity manager
*
* @return EntityManager
*/
public function getEntityManager()
{
return $this->container->get('doctrine.orm.default_entity_manager');
}
/**
* return the doctrine class metadata handled by the Admin instance
*
* @return ClassMetadataInfo the doctrine class metadata handled by the Admin instance
*/
public function getClassMetaData()
{
return $this->getEntityManager()
->getClassMetaData($this->getClass());
}
/**
* return the FormBuilder
*
* @return FormBuilder
*/
public function getFormBuilder()
{
return $this->container->get('base_application.builder.orm_form');
}
/**
* return the ListBuilder
*
* @return ListBuilder
*/
public function getListBuilder()
{
return $this->container->get('base_application.builder.orm_list');
}
/**
* return the FilterBuilder
*
* @return FilterBuilder
*/
public function getDatagridBuilder()
{
return $this->container->get('base_application.builder.orm_datagrid');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment