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. ...

Get Professional PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.