PHP Classes

File: src/Exception/MustBeNonEmpty.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   EasyDB   src/Exception/MustBeNonEmpty.php   Download  
File: src/Exception/MustBeNonEmpty.php
Role: Class source
Content type: text/plain
Description: Class source
Class: EasyDB
Simple Database Abstraction Layer around PDO
Author: By
Last change: Refactoring

- Change exceptions to extend the same base class
- Update code style to avoid \\ prefixes (use imports instead)
Date: 1 year ago
Size: 1,177 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\EasyDB\Exception;

use
ParagonIE\Corner\CornerInterface;
use
ParagonIE\Corner\CornerTrait;

/**
 * Class MustBeNonEmpty
 * @package ParagonIE\EasyDB\Exception
 */
class MustBeNonEmpty extends EasyDBException
{
    use
CornerTrait;

    public function
__construct(string $message = "", int $code = 0, \Throwable $previous = null)
    {
       
parent::__construct($message, $code, $previous);
       
$this->supportLink = 'https://github.com/paragonie/easydb';
       
$this->helpfulMessage = "By default, arrays passed to EasyStatement's in(), orIn(), andIn() methods must
not be empty.

If you're generating a lot of dynamic arrays and wish to allow empty arrays to
soft-fail to an empty set, simply call setEmptyInStatementsAllowed(), like so:

    - \$stmt = EasyStatement::open()->setEmptyInStatementsAllowed();
    + \$stmt = EasyStatement::open()->setEmptyInStatementsAllowed(true);

Note that an empty IN statement yields an empty result. If you want it to fail
open (a.k.a. discard the IN() statement entirely), you'll need to implement
your own application logic to handle this behavior."
;


    }
}