I have a function that I need a few controllers. Can i call it in some other way than to extend the class in which the function is? Question:
class CategoryController extends Controller
{
public function getCategoriesAction()
{
$categories = $this->getDoctrine()->getRepository('ModelBundle:Category')->findAll();
return $categories;
}
}
How call this function in PostController?
SymfonyController's actions returnsResponseObject, not arrays. But inPostControlleryou still can do$this->getDoctrine()->getRepository('ModelBundle:Category')->findAll();