duanji1056 2012-04-12 01:38
浏览 31
已采纳

Zend Auth - 使用两个表

I'm currently developing a website in Zend Framework wich uses Zend_Auth. The current design of the database is the following:

  • users - id / email
  • users_props - id - user_id - prop_name - prop_value

However, the current Zend_Auth_Adapter_DbTable uses only one table, as where I have to tables and need to join them.

How on earth can I do this? As far as i'm concerned, there are three options:

  1. I somehow create a (mysql) view
  2. I change the design so the users table contains both username/password
  3. I rewrite the Zend_Auth_Adapter_DbTable to a Custom_Auth_Adapter_DbTabe

Can anyone point me out what the best practise is?

Thanks in advance :)

  • 写回答

1条回答 默认 最新

  • douyun1852 2012-04-12 01:52
    关注

    The proper thing to do is to create a custom Zend_Auth_Adapter that authentication to your particular DB schema.

    Its actually pretty easy, there is only a single method in the interface to implemnt. Its also possible you could jsut extend Zend_Auth_Db_Adapter and override methods as necessary. Probably only what builds executes and returns the query result. But honestly i would just implment the interfae from scratch were it me. A lot easier that way IMO :-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 用AT89C52单片机设计一个温度测量与控制电路
  • ¥15 无法import pycausal
  • ¥15 VS2022创建MVC framework提示:预安装的程序包具有对缺少的注册表值的引用
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义
  • ¥15 嵌入式--定时器使用
  • ¥20 51单片机学习中的问题
  • ¥30 Windows Server 2016利用兩張網卡處理兩個不同網絡
  • ¥15 Python中knn问题
  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库