Zend Auth-使用两个表 [英] Zend Auth - Using two tables

查看:103
本文介绍了Zend Auth-使用两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Zend_Auth在Zend Framework中开发一个网站.数据库的当前设计如下:

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

  • 用户-ID/电子邮件
  • users_props-id-user_id-prop_name-prop_value

但是,当前的Zend_Auth_Adapter_DbTable仅使用一个表,因为我必须在这些表中需要连接它们.

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. 我以某种方式创建了(mysql)视图
  2. 我更改了设计,以便用户表同时包含用户名/密码
  3. 我将Zend_Auth_Adapter_DbTable重写为Custom_Auth_Adapter_DbTabe

有人能指出我的最佳做法吗?

Can anyone point me out what the best practise is?

先谢谢您了:)

推荐答案

正确的做法是创建一个自定义Zend_Auth_Adapter,以对您特定的数据库模式进行身份验证.

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

实际上非常简单,接口中只有一个方法可以实现.还可以根据需要扩展Zend_Auth_Db_Adapter并重写方法.可能只有构建的内容执行并返回查询结果.但说实话,我只是从头开始实施接口. IMO:-)

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 :-)

这篇关于Zend Auth-使用两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆