开发者

Symfony, database object: I need one more class to inherit?

开发者 https://www.devze.com 2023-03-27 20:03 出处:网络
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() log

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消