src/AnnotationProcessor/DoctrineAnnotationProcessor.php
private function processBidirectional($annotation, PropertyInformation $information): void
    {
        // Parse the mappedBy and inversedBy columns, there is no nice interface
        // on them so we have to check for existence of the property.
        if (property_exists($annotation, 'inversedBy') && $annotation->inversedBy) {
            $information->setReferencedProperty($annotation->inversedBy);
        } elseif (property_exists($annotation, 'mappedBy') && $annotation->mappedBy) {
            $information->setReferencedProperty($annotation->mappedBy);
        }

        if ($annotation instanceof ManyToOne || $annotation instanceof ManyToMany) {
            $information->setReferencingCollection(true);
        }

        // Set default value for nullable.
        if ($information->isNullable() === null) {
            $information->setNullable((new JoinColumn())->nullable);
        }

        // Set field name for index on this collection.
        if (!property_exists($annotation, 'indexBy') || !$annotation->indexBy) {
            return;
        }

        $information->setIndex($annotation->indexBy);
    }
private function processBidirectional($annotation, PropertyInformation $information): void
    {
        // Parse the mappedBy and inversedBy columns, there is no nice interface
        // on them so we have to check for existence of the property.
        if (property_exists($annotation, 'inversedBy') && $annotation->inversedBy) {
            $information->setReferencedProperty($annotation->inversedBy);
        } elseif (property_exists($annotation, 'mappedBy') && $annotation->mappedBy) {
            $information->setReferencedProperty($annotation->mappedBy);
        }

        if ($annotation instanceof ManyToOne || $annotation instanceof ManyToMany) {
            $information->setReferencingCollection(true);
        }

        // Set default value for nullable.
        if ($information->isNullable() === null) {
            $information->setNullable((new JoinColumn())->nullable);
        }

        // Set field name for index on this collection.
        if (!property_exists($annotation, 'indexBy') || !$annotation->indexBy) {
            return;
        }

        $information->setIndex($annotation->indexBy);
    }
private function processBidirectional ( $ annotation , PropertyInformation $ information ) : void { // Parse the mappedBy and inversedBy columns, there is no nice interface // on them so we have to check for existence of the property. if ( property_exists ( $ annotation , 'inversedBy' ) && $ annotation -> inversedBy ) { $ information -> setReferencedProperty ( $ annotation -> inversedBy ) ; } elseif ( property_exists ( $ annotation , 'mappedBy' ) && $ annotation -> mappedBy ) { $ information -> setReferencedProperty ( $ annotation -> mappedBy ) ; } if ( $ annotation instanceof ManyToOne || $ annotation instanceof ManyToMany ) { $ information -> setReferencingCollection ( true ) ; } // Set default value for nullable. if ( $ information -> isNullable ( ) === null ) { $ information -> setNullable ( ( new JoinColumn ( ) ) -> nullable ) ; } // Set field name for index on this collection. if ( ! property_exists ( $ annotation , 'indexBy' ) || ! $ annotation -> indexBy ) { return ; } $ information -> setIndex ( $ annotation -> indexBy ) ; }
Return referenced entity if we have a bidirectional doctrine association.

@throws \DomainException
@throws \InvalidArgumentException

@param mixed $annotation with annotation Annotation
@param PropertyInformation $information
Return referenced entity if we have a bidirectional doctrine association .