Help with system change with less work

0

I have a product table:

CREATE TABLE produtos (
  idProduto int(2) unsigned NOT NULL AUTO_INCREMENT,
  tipo enum('m','p') NOT NULL,
  modelo varchar(100) NOT NULL DEFAULT '',
  bandejas enum('1','2') NOT NULL DEFAULT '1',
  peso int(4) DEFAULT '0',
  prensagem int(4) NOT NULL DEFAULT '0',
  precoUnitario int(5) NOT NULL DEFAULT '0',
  comprimento int(3) NOT NULL,
  largura int(3) NOT NULL,
  cabo varchar(50) NOT NULL DEFAULT '',
  ligacao enum('m','b') NOT NULL DEFAULT 'b',
  potencia int(7) NOT NULL DEFAULT '0',
  consumo int(7) NOT NULL DEFAULT '0',
  corrente int(2) NOT NULL DEFAULT '0',
  disjuntor int(2) NOT NULL DEFAULT '0',
  descricao text NOT NULL,
  estoque int(2) NOT NULL DEFAULT '0',
  bloqueado char(1) NOT NULL DEFAULT '',
  PRIMARY KEY (idProduto)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8;

And Product Classes

<?php
 Class Produtos {

  private $idProduto; 
  private $tipo;  
  private $modelo;   
  private $bandejas;    
  private $peso;  
  private $prensagem;  
  private $precoUnitario;  
  private $comprimento;  
  private $largura;
  private $cabo;
  private $ligacao;  
  private $potencia;
  private $consumo;
  private $corrente;
  private $disjuntor;
  private $descricao;
  private $estoque;
  private $bloqueado;  

  public function __construct (
      $_tipo,  
      $_modelo,   
      $_bandejas,    
      $_peso,  
      $_prensagem,
      $_precoUnitario,  
      $_comprimento,  
      $_largura,
      $_cabo,
      $_ligacao,  
      $_potencia,
      $_consumo,
      $_corrente,
      $_disjuntor,
      $_descricao,
      $_estoque,
      $_bloqueado
                     ) {
      $this->tipo =  $_tipo;
      $this->modelo = $_modelo;
      $this->bandejas = $_bandejas;
      $this->peso = $_peso;
      $this->prensagem = $_prensagem;
      $this->precoUnitario = $_precoUnitario;
      $this->comprimento = $_comprimento;
      $this->largura = $_largura;
      $this->cabo = $_cabo;
      $this->ligacao = $_ligacao;
      $this->potencia = $_potencia;
      $this->consumo = $_consumo;
      $this->corrente = $_corrente; 
      $this->disjuntor = $_disjuntor;
      $this->descricao = $_descricao;
      $this->estoque = $_estoque;
      $this->bloqueado = $_bloqueado;
  }

  ////////////////////// SET'ERS  //////////////////  

  public function setIdProduto ($_idProduto) {
      $this->idProduto = $_idProduto;
  }

  public function getIdProduto(){
      return $this->idProduto;
  }

  public function getTipo () {
      return $this->tipo;
  }

  public function getModelo () {
      return $this->modelo;
  }

  public function getBandejas(){
      return $this->bandejas;
  }

  public function getPeso(){
      return $this->peso;
  } 

  public function getPrensagem(){
      return $this->prensagem;
  } 

  public function getPrecoUnitario(){
      return $this->precoUnitario;
  }  

  public function getComprimento(){
      return $this->comprimento;
  }

  public function getLargura(){
      return $this->largura;
  }

  public function getCabo(){
      return $this->cabo;
  }

  public function getLigacao(){
      return $this->ligacao;
  }

  public function getPotencia(){
      return $this->potencia;
  }

  public function getConsumo(){
      return $this->consumo;
  }

  public function getCorrente(){
      return $this->corrente;
  }

  public function getDisjuntor(){
      return $this->disjuntor;
  }

  public function getDescricao(){
      return $this->descricao;
  }

  public function getEstoque(){
      return $this->estoque;
  }

  public function getBloqueado(){
      return $this->bloqueado;
  }
}

In the beginning, it would be to register only machines that have all those attributes.

However, in the end, the customer decided to sell also in the store, accessories of these machines of the most diverse type and that logically does not have several of the attributes that the machines have. For example we can mention sheet metal used for the making of machines who do not attributes type electric current, power, etc ... But they have attributes of type weight, price, etc ...

Any solution in OO that will help me not to have a general system remodeling job in order to get around this problem?

    
asked by anonymous 23.10.2016 / 16:37

0 answers