PHP code example of jimmeak / doctrine-bundle

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

    

jimmeak / doctrine-bundle example snippets


// config/bundles.php



return [
    ...
    Jimmeak\DoctrineBundle\JimmeakDoctrineBundle::class => ['all' => true],
]

// src/Entity/SomeEntity.php


use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
class Person {
    # Creating autogenerated UUID v7
    use \Jimmeak\DoctrineBundle\Trait\UuidV7    
    
    # Giving Person FirstName attribute, getter and setter.
    use \Jimmeak\DoctrineBundle\Trait\FirstName; 
    
    # Giving Person LastName attribute, getter and setter.
    use \Jimmeak\DoctrineBundle\Trait\LastName;  
}

#[ORM\Entity]
class User {
    # Creating autogenerated UUID v7
    use \Jimmeak\DoctrineBundle\Trait\UuidV7
    
    # Giving Entity User First name, Last name, getters and setters
    # Giving Entity User one additional getter for Full name
    # with optional reverse possibility 
    use \Jimmeak\DoctrineBundle\Trait\FullName;
}

// src/Resolver/MyOwnDoctrineNameResolver.php



namespace Resolver;

use Jimmeak\DoctrineBundle\Resolver\NameResolverInterface;

class MyOwnDoctrineNameResolver implements NameResolverInterface
{
    public function name(string $namespace, string $prefix): string
    {
        // return your table name based on namespace and prefix
    }

    public function manyToManyName(string $sourceEntityNamespace, string $targetEntityNamespace, string $prefix): string
    {
        // return your table name for joining table (relation many to many)
        // having source and target entity namespaces and prefix.
    }
}