Open TomAMarine opened 2 years ago
I have the same (or a similar) thing here, maybe I'm doing something wrong, but I can't find the problem.
My Product entity
/**
* @ORM\Entity
*/
class Product
{
…
/**
* @ORM\OneToMany(targetEntity="Release", mappedBy="product", cascade={"persist", "remove"}, orphanRemoval=true, fetch="EAGER")
*/
protected Collection $releases;
has many releases (with further associations)
/**
* @ORM\Entity
*/
class Release
{
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Product", inversedBy="releases")
*/
private Product $product;
/**
* @ORM\Id
* @ORM\OneToOne(targetEntity="Market")
*/
private Market $market;
/**
* @ORM\Id
* @ORM\OneToOne(targetEntity="Language")
*/
private Language $language;
}
whenever I try to remove releases from the product's collection, I get the error unknown field "product", "market", "language"
.
The Doctrine diff command created migrations with the correct field names product_id, market_id, language_id
here.
Hi,
I have a problem in the configuration of Doctrine.
I have two PHP classes described below. A class that represents a boat model "Model" and another that represents an alias "ModelAlias". Example: "ANTARES 6 FISHING" is an alias of "ANTARES 6". These two names correspond to the same boat.
A model can have 0 or more aliases. The unique key of my "ModelAlias" entity is a combination of the model id and the alias name. So, I added the annotation "@ORM\Id" on "model" and "name" properties. The property "model" is a relation to the "Model" entity.
Simplified class "Model"
Simplified Class "ModelAlias"
When I delete the alias with "remove" function Doctrine, I get an error message :
The DELETE request generated by Doctrine is :
But, the column name "model" is invalid. It should be "model_id" because I have this annotation "@ORM\JoinColumn(name="model_id")" on the "model" property.
Do you have an idea to fix my problem ?
Thank you for you help.