PHP code example of fourhundredfour / doctrine-lombok

1. Go to this page and download the library: Download fourhundredfour/doctrine-lombok 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/ */

    

fourhundredfour / doctrine-lombok example snippets


// my_source/Entity/User.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