Skip to content

About

[READ-ONLY] Entity-backed Exists and Unique validation rules for Marko Framework. Issues and PRs at https://github.com/marko-php/marko

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marko/validation-database

Entity-backed Exists and Unique validation rules --- looks records up by entity class and property through marko/database.

Installation

composer require marko/validation-database

Requires marko/database and a database driver. Installing the package binds RecordLookupInterface; no configuration is needed.

Quick Example

use App\Blog\Entity\Channel;
use App\Blog\Entity\User;
use Marko\Validation\Rules\RecordRules;

public function __construct(
    private readonly RecordRules $recordRules,
) {}

$rules = [
    'channel_id' => ['required', $this->recordRules->exists(Channel::class)],
    'email' => ['required', 'email', $this->recordRules->unique(User::class, 'email')->caseInsensitive()->ignore($user->id)],
];

Documentation

Full usage, API reference, and examples: marko/validation-database

About

[READ-ONLY] Entity-backed Exists and Unique validation rules for Marko Framework. Issues and PRs at https://github.com/marko-php/marko

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages