29 lines
900 B
PHP
29 lines
900 B
PHP
<?php
|
|
|
|
use Bcs\Databaseinterface\SqlSrvClient;
|
|
use Bcs\CategoryChecker\CategoryChecker;
|
|
use Hpz937\Encryption\DataEncryptor;
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
$dotenv->load();
|
|
|
|
|
|
// Usage
|
|
// Assuming $pdo is your PDO instance connected to the MSSQL database
|
|
// and $csvFilePath is the path to your CSV file
|
|
$enc = new DataEncryptor($_ENV['ENCRYPTION_KEY']);
|
|
$sqlSrvClient = new SqlSrvClient(
|
|
$_ENV['MSSQL_SERVER_NAME'],
|
|
$_ENV['MSSQL_DATABASE'],
|
|
$_ENV['MSSQL_USERNAME'],
|
|
$enc->decrypt($_ENV['MSSQL_PASSWORD'])
|
|
);
|
|
$csvFilePath = 'goggle-categories.csv';
|
|
$outputFilePath = 'mismatch-category-rpt.xlsx';
|
|
$outputCsvFilePath = 'remove-cat.csv';
|
|
|
|
$categoryChecker = new CategoryChecker($sqlSrvClient, $csvFilePath);
|
|
$categoryChecker->outputMismatchesAsXlsx($outputFilePath);
|
|
$categoryChecker->outputMissingCategoriesAsCsv($outputCsvFilePath); |