Questions tagged [doctrine-mapping]

13 questions
5
votes
1 answer

How to describe multi-column foreign key in Doctrine mapping

We have a database schema that, in simplified (slightly contrived) form, looks like: Where the foreign key from users to domains is set on columns (domainId, groupId), to guarantee referential integrity. This structure works fine for the intended…
Jacco
  • 23,534
  • 17
  • 88
  • 105
4
votes
0 answers

how to add/remove an entity's mapping programmatically

I have a handler which uses the same Entity for two different kind of queries: /** * @ORM\Entity * @ORM\Table(name="app_iso50k1.meter", schema="app_iso50k1") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="mettype",…
Bertuz
  • 2,390
  • 3
  • 25
  • 50
2
votes
1 answer

Doctrine mapping on a single table having a composed primary key made of 3 fields

I am struggling with choosing the right mapping for the following category like scenario : The food entity has a composed primary key made of 3 fields plus a name field: ╔════════╦═══════╦════════╦════════════════╗ ║ family ║ class ║ sector ║ name…
Stphane
  • 3,368
  • 5
  • 32
  • 47
1
vote
1 answer

Api-Platform + Swagger: group operations/entities by Doctrine or ApiPlatform mapping

I have config/packages/api_platform.yaml: api_platform: mapping: paths: - '%kernel.project_dir%/src/Entity' - '%kernel.project_dir%/old/Entity' In both namespaces I have entities with the same name. What do I…
1
vote
1 answer

Expected value of type for association field , got "double" instead

I want to put a number into a NumberType field, but when I get this exception: Expected value of type "GestionBundle\Entity\MaterialCost" for association field "GestionBundle\Entity\Intervention#$materialCost", got "double"…
delph49
  • 79
  • 1
  • 11
1
vote
1 answer

Doctrine 2 Mapping of 2 tables, error

Zend Framework 3, Doctrine 2. I created some mapping of 2 tables MySQL /** * @ORM\Entity * @ORM\Table(name="object") */ class Object { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(name="id") */ protected $id; /** …
1
vote
0 answers

how to safely remove an entity when not referenced anymore

I have the following Entity scenario: class PhyVarSelection { /** * @ORM\ManyToOne( * targetEntity="PhyVar", * cascade={"persist"}) * * @ORM\JoinColumn( * name="phy_var_sel", * …
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
0 answers

how can i deal with redundant property when using inheritance table with doctrine in symfony project?

I am using the Table Inheritance class with Doctrine to make the Doctors class inherit the properties of the Users class. The Users class has an @ORM\ManyToMany relation implemented to the Doctors class. Here is the code for the two…
0
votes
1 answer

Symfony Mapping Error: "The association Entity\Rule#ruleSettings refers to the owning side field Entity\RuleSettings#rules which does not exist."

I would ask why am I getting error [FAIL] The entity-class AppBundle\Entity\Rule mapping is invalid: * The association AppBundle\Entity\Rule#ruleSettings refers to the owning side field AppBundle\Entity\RuleSettings#rules which does not exist. …
0
votes
0 answers

Doctrine OneToMany relationship mapping missing inversedBy

I am attempting to create a OneToMany relationship between two of my entities. One Customer can be a member of many Clubs. These are my entities: class Club { /** * @ORM\ManyToOne(targetEntity="Customer", inversedBy="clubs") */ …
crmpicco
  • 16,605
  • 26
  • 134
  • 210
0
votes
0 answers

Symfony: Doctrine Mapping within three tables and display data in loop of checkboxes

I tried to not repeat myself so I had checked so many references but none of them touch my situation. I have three tables with columns below: location T1 location_amenity T2 location_location_amenity T3 id | name id | name …
0
votes
2 answers

Symfony One-To-Many unidirectional relation without JOIN table

I have the following tables: strings ------ "id" int not null primary key string_texts ------ "id" int not null primary key "string_id" int not null fk(strings.id) "language_id" int not null fk(languages.id) "text" …
Zoltán Fekete
  • 504
  • 1
  • 6
  • 22
0
votes
1 answer

override mapping for a specific Entity class

I'm using a standard Symfony 2.8 framework with Doctrine. My entities' mappings are all annotated, but I would need to map a single entity by using the PHP way (by defining loadMetadata static method) . I know there's a way to override a mapping…
Bertuz
  • 2,390
  • 3
  • 25
  • 50