<?php
namespace  Offy\Bundle\DashboardBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\Controller\Annotations\View;
class DepartmentController extends Controller
{
    /**
     * 
     * @return array
     * @View()
     */
    public function getDepartmentAction()
    {
         $repository = $this->get('doctrine_mongodb')
                ->getManager()
                ->getRepository('OffyDashboardBundle:HrDepartment');
//        $allDepartment = new \Offy\Bundle\DashboardBundle\Document\HrDepartment();
//        
//        $allDepartment->setId(0);
//        $allDepartment->setDepartmentId(0);
//        $allDepartment->setName("All");
        
        $hrdepartments = $repository->findAll();
//        $hrdepartments[] = $allDepartment;
        return array("results"=>true,"error"=>"ok","data"=>$hrdepartments);
    
    }
}
