doctrine/orm · error · BadMethodCallException

Class {name} has a composite identifier.

Error message

Class {name} has a composite identifier.

What it means

Error "Class {name} has a composite identifier." thrown in doctrine/orm.

Source

Thrown at src/Mapping/ClassMetadata.php:618

    public function getReflectionProperty(string $name): ReflectionProperty|null
    {
        return $this->reflFields[$name];
    }

    public function getPropertyAccessor(string $name): PropertyAccessor|null
    {
        return $this->propertyAccessors[$name] ?? null;
    }

    /**
     * @deprecated Use getPropertyAccessor() instead.
     *
     * @throws BadMethodCallException If the class has a composite identifier.
     */
    public function getSingleIdReflectionProperty(): ReflectionProperty|null
    {
        if ($this->isIdentifierComposite) {
            throw new BadMethodCallException('Class ' . $this->name . ' has a composite identifier.');
        }

        return $this->reflFields[$this->identifier[0]];
    }

    /** @throws BadMethodCallException If the class has a composite identifier. */
    public function getSingleIdPropertyAccessor(): PropertyAccessor|null
    {
        if ($this->isIdentifierComposite) {
            throw new BadMethodCallException('Class ' . $this->name . ' has a composite identifier.');
        }

        return $this->propertyAccessors[$this->identifier[0]];
    }

    /**
     * Extracts the identifier values of an entity of this class.
     *

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Mapping/ClassMetadata.php:618 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of doctrine/orm@d9b9ff7301 (2026-08-21). Data as JSON: /api/errors/fa15ab7f3fab276f. Report an issue: GitHub.