Closed milan74sk closed 7 years ago
It's fixed in 1.3.0. it now use the primary key identifier.
(not that it is not supporting multiple columns as primary key.)
I believe this is still an issue, unless I'm doing something else wrong. I'm getting this error on an Entity which has a primary key on a column named "iso"
[Symfony\Component\Debug\Exception\UndefinedMethodException] Attempted to call an undefined method named "getId" of class "AppBundle\Entity\Country".
Edit: I'm also getting this error:
[Doctrine\ORM\ORMException] Entity 'Umem\UtilitiesBundle\Entity\State' has no field 'id'. You can therefore not call 'findById' on the entities' repository
Here's part of the entity definition:
/**
* Country
*
* @ORM\Table(name="country")
* @ORM\Entity
*/
class Country {
/**
* @var string
*
* @ORM\Column(name="iso", type="string", length=2, nullable=false)
* @ORM\Id
*/
private $iso;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=80, nullable=false)
*/
private $name;
Are you sure you are on the lastest version 1.3.*?
I tried with both dev-master and v1.3.2.
The stack trace shows the first error originating from this line: https://github.com/Webonaute/DoctrineFixturesGeneratorBundle/blob/321089ef7fb01ea6151efff0373313a4c7af86a4/Tool/FixtureGenerator.php#L463
The second error from this line: https://github.com/Webonaute/DoctrineFixturesGeneratorBundle/blob/e87e6bc19fa71556a4424b91c2b1df9f3e11347a/Generator/DoctrineFixtureGenerator.php#L101
oh yeah true, I forget to remove the old line of code for the id! my bad. going to fix it
For your second error, you entity state doesnt have ID. I dont plan to support such entities. its a bad behaviour to not have at least one unique identifier.
issue fixed in 1.3.3.
Thank for the head up.
or is there any possibility how to specify it by e.g. config, or how to make it work with another PK like id.
My tables have PK record_id not just id. So the bundle should know to call ->getRecordId() and not ->getId(). Before this I can't use it, even it is great utility.
thank you