In the previous chapter we learned how to implement a basic database operation, namely, table insert
. In this section, you will learn all the basic database operations necessary for building a simple CRUD (Create, Read, Update and Delete) interface.
The TableGateway
class extends AbstractTableGateway
, which implements TableGatewayInterface
. The interface definition of TableGatewayInterface
is provided in the following code snippet; all the basic table operations are defined in the interface:
interface Zend\Db\TableGateway\TableGatewayInterface { public function getTable(); public function select($where = null); public function insert($set); public function update($set, $where = null); public function delete($where); }
The TableGateway
class offers a wide range of methods to perform basic database operations; some of the most frequently used methods are explained in the following section: