Symfony, database object: I need one more class to inherit?
You know, in Symfony you get auto generated base class for database tables. I got an "user" table which stores users, passwords, and got already a pre-made template class for it. Its got login()
logout()
etc. routines (it just writes the session).
So, in different applications I would just write something like that开发者_C百科:
class myUserClass extends UserClassTemplate
so I dont need to write login, logout again and again. But this time, I inherit a Symfony's base class - how can I inherit my template?
If you use Doctrine, you could write a custom behavior (or template) to achieve this thanks to the delegation of method calls (and not with multiple-inheritance, which is not available in php). See this example with... guess what? UserTemplate!
精彩评论