Entity#parents is not an association with a single join column #5689

Open
opened 2026-01-22 15:14:36 +01:00 by admin · 0 comments
Owner

Originally created by @bordeux on GitHub (Sep 7, 2017).

I wrote library to fetch geoNames to database for doctrine. It works fine, but when i want run tests i received this error:

Doctrine\ORM\Mapping\MappingException: 'Bordeux\Bundle\GeoNameBundle\Entity\GeoName#parents' is not an association with a single join column.

Here is result from travis-ci: https://travis-ci.org/bordeux/geoname-bundle/jobs/270466374

I dont know what that message exactly means, because from my side everything is correct.

This is my definition of paretns field:

/**
 * @var Hierarchy[]
 *
 * @ORM\OneToMany(targetEntity="Bordeux\Bundle\GeoNameBundle\Entity\Hierarchy", mappedBy="child")
 */
protected $parents;

And that is definition in hierarchy:

/**
 * @var GeoName
 *
 * @ORM\ManyToOne(targetEntity="Bordeux\Bundle\GeoNameBundle\Entity\GeoName", inversedBy="parents")
 * @ORM\JoinColumn(name="child_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
 */
protected $child;

Source: https://github.com/bordeux/geoname-bundle/tree/master/Entity

Originally created by @bordeux on GitHub (Sep 7, 2017). I wrote library to fetch geoNames to database for doctrine. It works fine, but when i want run tests i received this error: > Doctrine\ORM\Mapping\MappingException: 'Bordeux\Bundle\GeoNameBundle\Entity\GeoName#parents' is not an association with a single join column. Here is result from travis-ci: https://travis-ci.org/bordeux/geoname-bundle/jobs/270466374 I dont know what that message exactly means, because from my side everything is correct. This is my definition of paretns field: <pre code=php> /** * @var Hierarchy[] * * @ORM\OneToMany(targetEntity="Bordeux\Bundle\GeoNameBundle\Entity\Hierarchy", mappedBy="child") */ protected $parents; </pre> And that is definition in hierarchy: <pre> /** * @var GeoName * * @ORM\ManyToOne(targetEntity="Bordeux\Bundle\GeoNameBundle\Entity\GeoName", inversedBy="parents") * @ORM\JoinColumn(name="child_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") */ protected $child; </pre> Source: https://github.com/bordeux/geoname-bundle/tree/master/Entity
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5689