Exemplo n.º 1
0
 /**
  * Manage the input.
  */
 public function manageInput()
 {
     $method = filter_input(INPUT_SERVER, 'REQUEST_METHOD');
     //TODO - violating DRY
     $input = $this->getInput();
     //create
     if ($method === 'POST') {
         if (!empty($input)) {
             $this->persistenceModel->createRow($input);
         }
     }
     //read
     if ($method === 'GET') {
     }
     //update
     if ($method === 'PUT') {
         if (!empty($input)) {
             $this->persistenceModel->updateRow($input);
         }
     }
     //delete
     if ($method === 'DELETE') {
         $this->persistenceModel->deleteRow();
     }
     $this->persistenceModel->output = $this->urlModel->main($this->table);
 }
Exemplo n.º 2
0
 public function testDeleteRow()
 {
     $this->markTestSkipped('To test in real environment, edit this test');
     //query class, e.g. UsersQuery
     $query = \Propel\Runtime\ActiveQuery\ModelCriteria::class;
     $this->persistenceModel->query = $this->createMock($query);
     $this->persistenceModel->ormModel->method('delete')->willReturn($this->persistenceModel->key);
     $this->assertEquals($this->persistenceModel->key, $this->persistenceModel->deleteRow());
 }