Skip to content

A Doctrine library to create getter/setter at runtime with annotations.

License

Notifications You must be signed in to change notification settings

fourhundredfour/doctrine-lombok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doctrine-lombok

A Doctrine library to create getter/setter at runtime with annotations.

Index

Requirements

  • Doctrine
  • =PHP 7.4

Usage

// my_source/Entity/User.php
<?php

namespace Schischkin\DoctrineLombok\Entity;

use Schischkin\DoctrineLombok\Annotations\Getter;
use Schischkin\DoctrineLombok\Annotations\Setter;

/** @Getter */
class User {
    /** @Setter */
    private $username;
    private $password;
}
// app.php
...
$annotation = new Schischkin\DoctrineLombok\Annotation($reader);
$classLoader = new Schischkin\DoctrineLombok\ClassLoader();

$classNames = $classLoader->loadClasses(__DIR__ . '/my_source');
foreach ($classNames as $className) {
    $annotation->parseClassByClassName($className);
}

$user = new User();
$user->setUsername('fourhundredfour');
echo $user->getUsername(); // Access to the private property

Badges

Maintainability Rating Reliability Rating Security Rating Quality Gate Status Technical Debt Vulnerabilities Bugs Code Smells