O'Reilly logo

Professional PHP Design Patterns by Aaron Saray

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

21.3. Designing Contact Administration

Because of the extreme flexibility that the application will demonstrate, this next section works with a more complex set of relationships. In addition to these relationships, interfaces need to be created to add, edit, and delete any of those objects. Another interface needs to be created to adapt a set of contacts from Outlook into new contacts in this system. Finally, users need to be able to view the contacts that they own.

This contact administration is broken up into the following steps:

  • Working with contacts and information

  • Contact information relationships

  • Importing contacts

  • Viewing contacts

21.3.1. Working with Contacts and Information

The root of the contacts interaction is the ContactsModule. I'm going to start by defining this module (Figure 21-12).

Figure 21-12. Figure 21-12

Predictably, the ContactsModule is an instance of a Module object. It has eight public methods. Displaying and processing additions, edits, and deletions are represented. Methods for accepting and processing the contacts to be imported are also defined. Finally, the view() method will be used to show an individual contact. There are two protected methods, addmethods() and deletemethods().

addmethods() will accept two parameters. One will be the current Contact that the application is adding methods to. The other will be an array of group and method information. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required