How can I get container object in repository class without passing parameter?

Chintan Mirani

How can I get container object in repository class without passing parameter?

Ashok Chitroda

You will get container object as follow:

// include files to get container
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

class ClassNameRepository extends EntityRepository implements ContainerAwareInterface
{
    /**
     * @var ContainerInterface
     *
     * @author Ashok Chitroda <[email protected]>
     */
    private $container;

    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }
}

Thanks

Ashok Chitroda

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can i get class from Object parameter?

How can i get host application handle in dll project with Delphi without passing handle parameter

Adapter pattern without passing class object as parameter

How can I use variables without passing them as a parameter?

How can I call a javascript/typescript constructor by passing an object as parameter?

How can I make an array accessible into a class without passing it?

How can I pass an object from container to class in Meteor and React?

How can I get the HttpRequest object in an ApiController without using the HttpContext static class?

AsyncTask - How can i pass an object as parameter to an anonymous AsyncTask class

How to get reference of currently visible activity without passing it as parameter to other class

How can I get Class object for every class in a jar

How can I serialize an int value with json without class object?

VueJS: How can I get the parameter of the class that was clicked on?

How do I prevent my templated constructor to take the class as parameter when passing an object to a function

How I can get object as parameter from Servlet

How can I get the type of a class without instantiating it in Python?

How can I get a property of an object in powershell without using parentheses?

How can i print a list object and get a list without ' '?

How can I get an item from an object without title in powershell?

How can I create object of repository without having constructor values in Android-Kotlin?

How can I get value of EditorFor in ASP.Net Mvc and passing value in a button as parameter

How can I filter and get json data file by passing parameter by click?

How can I get the caller class object from a method in java?

How can I get companion object from a class name?

How can I get a class from a jQuery datatable row object?

How can I get value Model class Object to ArrayList as String?

How can I get HttpServletRequest Object in Jodd action class?

Java How to avoid passing Class as parameter of generic object

How can you call a void function in Flutter without passing a parameter?

TOP Ranking

HotTag

Archive