0

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

Phil
  • 157,677
  • 23
  • 242
  • 245
ChrisH
  • 1,283
  • 1
  • 9
  • 22

1 Answers1

4

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

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • Your comment made me realise I was searching wrong. It's pretty easy actually. For others looking for Zend_Auth_Adapter_DbTable wanting to use two columns; write your own Custon_Auth_Adapter. For example: http://stackoverflow.com/questions/3328047/creating-own-zend-auth-adapter :) – ChrisH Apr 12 '12 at 02:15