symfony function

// query by the primary key (usually "id")
$product = $repository->find($id);

// dynamic method names to find based on a column value
$product = $repository->findOneById($id);
$product = $repository->findOneByName('foo');

// find *all* products
$products = $repository->findAll();

// find a group of products based on an arbitrary column value
$products = $repository->findByPrice(19.99);

Example :

        $em = $this->getDoctrine()->getManager();
        $entities = $em->getRepository('AdminEmployeeBundle:Employee')->findAll();
        return $this->render('AdminEmployeeBundle:Default:view.html.twig', array(
                'entities' => $entities

Most usefull 

namespace Admin\EmployeeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

// handle Request
use Symfony\Component\HttpFoundation\Request;

// entity
use Admin\EmployeeBundle\Entity\Employee;

// form 
use Admin\EmployeeBundle\Form\EmployeeType;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s