PHP code example of jeyroik / extas-fields-conditions

1. Go to this page and download the library: Download jeyroik/extas-fields-conditions 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/ */

    

jeyroik / extas-fields-conditions example snippets


/**
 * @method itemRepo()
 */
$item = new class ([
    'value' => 'test'
]) extends \extas\components\Item {
    use \extas\components\THasValue;
    protected function getSubjectForExtension() : string{
        return 'item';
    }
};

try {
    $this->itemRepo()->create($item); // Exception "Condition failed"
} catch (\Exception $e) {

}
$item->setValue('unique');
$this->itemRepo()->create($item); // ok
$this->itemRepo()->create($item); // Exception "Condition failed"