1. Go to this page and download the library: Download nighten/doctrine-check 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/ */
nighten / doctrine-check example snippets
use App\Kernel;
use Nighten\DoctrineCheck\Config\DoctrineCheckConfig;
use Symfony\Component\Dotenv\Dotenv;
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$kernel->boot();
$config->addObjectManager($kernel->getContainer()->get('doctrine')->getManager());
};
#[
ORM\ManyToOne(targetEntity: User::class),
ORM\JoinColumn(nullable: false),
]
private User $user;
#[Embeddable]
class Address
{
#[ORM\Column(type: 'string', nullable: true)]
private ?string $code;
}
class User
{
#[Embedded(class: Address::class)]
private Address $address;
...
}
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV7;
//...
return function (DoctrineCheckConfig $config): void {
//...
$config->addTypeMapping('uuid', UuidV1::class);
$config->addTypeMapping('uuid', UuidV4::class);
$config->addTypeMapping('uuid', UuidV7::class);
};
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;
//...
return function (DoctrineCheckConfig $config): void {
//...
$config->addEntityClass(EntityClass::class);
};
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;
//...
return function (DoctrineCheckConfig $config): void {
//...
$config->addExcludedEntityClasses(EntityClass::class);
};
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;
//...
return function (DoctrineCheckConfig $config): void {
//...
$config->addIgnore(EntityClass::class, 'name', ErrorType::TYPE_WRONG_NULLABLE);
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.