Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // see lines 2/3 & 9/10
- namespace Bom\Model\DbTable; // TODO: **** Move data table gateway
- //Bom\Model;
- use Zend\Db\TableGateway\TableGateway,
- Zend\Db\Adapter\Adapter,
- Zend\Db\ResultSet\ResultSet;
- class BomTable extends TableGateway // TODO: **** Move data table gateway
- //class DbTable_BomTable extends TableGateway
- {
- public function __construct(Adapter $adapter = null, $databaseSchema = null,
- ResultSet $selectResultPrototype = null)
- {
- return parent::__construct('bom_file', $adapter, $databaseSchema,
- $selectResultPrototype); // the first value is the name of the targeted table
- }
- public function fetchAll()
- {
- $resultSet = $this->select();
- return $resultSet;
- }
- public function getBom($id)
- {
- $id = (int) $id;
- $rowset = $this->select(array('id' => $id));
- $row = $rowset->current();
- if (!$row) {
- throw new \Exception("Could not find row $id");
- }
- return $row;
- }
- public function addBom($field1, $field2, $field3, $field4, $field5)
- {
- $data = array(
- 'company_id' => $field1,
- 'contact_id_requestor' => $field2,
- 'contact_id_uploader' => $field3,
- 'uri' => $field4,
- 'notes' => $field5,
- 'datetime_created' => date('Y-m-d H:i:s'),
- );
- $this->insert($data);
- }
- public function updateBom($id, $field1, $field2, $field9)
- {
- $data = array(
- 'company_id' => $field1,
- 'contact_id_requestor' => $field2,
- 'notes' => $field9,
- );
- $this->update($data, array('id' => $id));
- }
- public function mapBom($id, $field5, $field6, $field7, $field8)
- {
- $data = array(
- 'separator' => $field5,
- 'delimiter' => $field6,
- 'first_data_row' => $field7,
- 'row_count' => $field8,
- );
- $this->update($data, array('id' => $id));
- }
- public function deleteBom($id)
- {
- $this->delete(array('id' => $id));
- }
- public function archiveBom($id)
- {
- ;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement