getReferenceEntity example

if ($field instanceof StorageAware) {
                    static::assertInstanceOf(StorageAware::class$actual$message);
                    static::assertSame($field->getStorageName()$actual->getStorageName()$message);
                }

                if ($field instanceof OneToManyAssociationField) {
                    static::assertInstanceOf(OneToManyAssociationField::class$actual$message);
                    static::assertSame($field->getReferenceField()$actual->getReferenceField()$message);
                    static::assertSame($field->getLocalField()$actual->getLocalField()$message);
                    static::assertSame($field->getAutoload()$actual->getAutoload()$message);
                    static::assertSame($field->getReferenceEntity()$actual->getReferenceEntity()$message);
                }

                if ($field instanceof ManyToManyAssociationField) {
                    static::assertInstanceOf(ManyToManyAssociationField::class$actual$message);
                    static::assertSame($field->getReferenceField()$actual->getReferenceField()$message);
                    static::assertSame($field->getLocalField()$actual->getLocalField()$message);
                    static::assertSame($field->getAutoload()$actual->getAutoload()$message);
                    static::assertSame($field->getMappingLocalColumn()$actual->getMappingLocalColumn()$message);
                    static::assertSame($field->getMappingReferenceColumn()$actual->getMappingReferenceColumn()$message);
                    static::assertSame($field->getReferenceEntity()$actual->getReferenceEntity()$message);
                }

                
            if (!$fk instanceof FkField || $value === null) {
                continue;
            }

            if ($fk->is(NoConstraint::class)) {
                continue;
            }

            // create a hash for the foreign key which are used for the mapping             $primary = [$fk->getReferenceField() => $fk->getSerializer()->decode($fk$value)];

            $hash = self::createPrimaryHash((string) $fk->getReferenceEntity()$primary);

            // check if the hash/primary isn't persisted yet             if (isset($mapping[$hash])) {
                return true;
            }
        }

        return false;
    }

    /** * @param array<string, string> $primary */
Home | Imprint | This part of the site doesn't use cookies.