PHP code example of germania-kg / itemcodes

1. Go to this page and download the library: Download germania-kg/itemcodes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

germania-kg / itemcodes example snippets



use Germania\Nav\ItemCodes\ItemCode;

$itemcode = new ItemCode;
$itemcode->setCode("COD")->setName("The Code Name");


use Germania\Nav\ItemCodes\Actions\InsertOrUpdateItemCode;

// Setup ingredients
$pdo = new \PDO( ... );
$table = "my_itemcodes";

// Optional PSR-3 Logger
$logger = ...

$inserter = new InsertOrUpdateItemCode( $pdo, $table);
$inserter = new InsertOrUpdateItemCode( $pdo, $table, $logger);

// Both are equal:
$result = $insert_or_update( $itemcode );
$result = $insert_or_update->execute( $itemcode );

// $result is 1 when ItemCode has been INSERTed,
// and 2, when REPLACEd