O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

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

Time for action — adding the fields to support the user documents

We already have the basic structure of user documents set up in the classes/user.php file, but let's go through and add a few more fields.

  1. We currently aren't setting _id in any of our projects, but we'll need to do that for our user documents. Let's open up classes/base.php, and add _id so that we have the option of setting _id on any document.
    <?php
    abstract class Base {
    protected $_id;
    
    protected $type;
    
  2. We need to add all of the user fields that we just discussed into the classes/user.php file, and a few others. Add the following code to classes/user.php so that it looks as follows:
    <?php
    class User extends Base {
    protected $name;
    protected $email;
    protected $full_name; protected ...

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