diff --git a/vendor/model/States.class.php b/vendor/model/States.class.php new file mode 100644 index 0000000..ad03c0d --- /dev/null +++ b/vendor/model/States.class.php @@ -0,0 +1,50 @@ +connection = new MySql(); + + } + + /** Listagem de todos os registros */ + public function all() + { + + /** Montagem do SQL */ + $this->sql = 'SELECT * FROM states ORDER BY name ASC'; + + /** Preparo o SQL para execução */ + $this->stmt = $this->connection->connect()->prepare($this->sql); + + /** Executo o SQL */ + $this->stmt->execute(); + + /** Retorno o resultado */ + return $this->stmt->fetchAll(\PDO::FETCH_OBJ); + + } + + /** Destrutor da classe */ + public function __destruct() + { + + /** Instanciamento da classe */ + $this->connection = null; + + } + +} \ No newline at end of file diff --git a/vendor/view/companies/companies_form.php b/vendor/view/companies/companies_form.php index a7a350f..2e90c7d 100644 --- a/vendor/view/companies/companies_form.php +++ b/vendor/view/companies/companies_form.php @@ -2,6 +2,8 @@ /** Importação de classes */ use vendor\model\Companies; +use vendor\model\Cities; +use vendor\model\States; try{ @@ -10,6 +12,8 @@ try{ /** Instânciamento de classes */ $Companies = new Companies(); + $Cities = new Cities(); + $States = new States(); /** Parametros de entrada */ $CompaniesId = isset($_POST['company_id']) ? $Main->antiInjection($_POST['company_id']) : 0; @@ -181,7 +185,23 @@ try{