Application\Base

The Application\Base class contains logic needed by the three service classes Main, Lookup, and Add. As with Connection, we define this class in the Application namespace. In this class, we provide useful constants and properties which represent the database collections products, purchases, and customers. We also provide access to the Application\Connection instance:

namespace Application; class Base {     const DATE_FORMAT = 'Y-m-d';     const DEFAULT_URL = '/json.php';     const DEFAULT_LIMIT = 100;     const DEFAULT_END_DATE = 'P99Y';     protected $connection;     protected $products;     protected $purchases;     protected $customers;     public function __construct($config) {         $this->connection = new Connection($config); $client = $this->connection->getClient(); ...

Get MongoDB 4 Quick Start Guide 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.