GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b24b89...149ff2 )
by joseph
12s
created

HasTemplateEntitiesUnidirectionalOneToMany   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A metaForTemplateEntities() 0 19 1
1
<?php declare(strict_types=1);
2
// phpcs:disable
3
namespace TemplateNamespace\Entity\Relations\TemplateEntity\Traits\HasTemplateEntities;
4
5
use Doctrine\Common\Inflector\Inflector;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use TemplateNamespace\Entities\TemplateEntity as TemplateEntity;
8
use TemplateNamespace\Entity\Relations\TemplateEntity\Traits\HasTemplateEntitiesAbstract;
9
10
/**
11
 * Trait HasTemplateEntitiesUnidirectionalOneToMany
12
 *
13
 * One instance of the current Entity (that is using this trait)
14
 * has Many instances (references) to TemplateEntity.
15
 *
16
 * @see     http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-unidirectional-with-join-table
17
 *
18
 * @package TemplateNamespace\Entities\Traits\Relations\TemplateEntity\HasTemplateEntities
19
 */
20
// phpcs:enable
21
trait HasTemplateEntitiesUnidirectionalOneToMany
22
{
23
    use HasTemplateEntitiesAbstract;
24
25
    /**
26
     * @param ClassMetadataBuilder $builder
27
     *
28
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
29
     * @SuppressWarnings(PHPMD.StaticAccess)
30
     */
31
    public static function metaForTemplateEntities(
32
        ClassMetadataBuilder $builder
33
    ): void {
34
        $manyToManyBuilder = $builder->createManyToMany(
35
            TemplateEntity::getPlural(),
36
            TemplateEntity::class
37
        );
38
        $fromTableName     = Inflector::tableize(static::getSingular());
39
        $toTableName       = Inflector::tableize(TemplateEntity::getPlural());
40
        $manyToManyBuilder->setJoinTable($fromTableName.'_to_'.$toTableName);
41
        $manyToManyBuilder->addJoinColumn(
42
            static::getSingular().'_'.static::getIdField(),
43
            static::getIdField()
44
        );
45
        $manyToManyBuilder->addInverseJoinColumn(
46
            TemplateEntity::getSingular().'_'.TemplateEntity::getIdField(),
47
            TemplateEntity::getIdField()
48
        );
49
        $manyToManyBuilder->build();
50
    }
51
}
52