Can we have a model class that is single in the Doctrine?
For Singleton classes, I have to have a private / protected constructor .... but this is not possible, as I am extending the Doctrine class, which has a public constructor
You can argue about using the Singleton template when interacting with the database, but just consider this scenario:
I have a user action log that is logged in the database. This registrar performs some initialization in the constructor (obtaining current user information from the session), which is common to all registrar instances for a specific execution.
There seems to be no way to implement a singleton pattern for models when using Doctrine?
rahul source
share