339 questions
2
votes
0
answers
386
views
Symfony 6 - Error while inserting a new Entry with a ManyToMany Relationship
I am currently working on a symfony 6 project where I came across the following problem:
I have to entites "Article" and "ColorPalette". The relationship between the both of these ...
1
vote
0
answers
59
views
Symfony/Doctrine ambiguity's regarding to ArrayCollection usage
I have two approaches and I need your expertise on the matter...
Let's say we call a certain API and store every request data into RequestEntity. And let's say that API call we made initiates some ...
1
vote
1
answer
1k
views
Symfony 5.2 - Form - CollectionType - The form's view data is expected to be a "App\Entity\...", but it is a array
I have this error when I try to render the form AvisType:
The form's view data is expected to be a "App\Entity\DTO\DocumentDTO",
but it is a "array". You can avoid this error by ...
0
votes
1
answer
4k
views
getChildren(): Return value must be of type Doctrine\Common\Collections\Collection, string returned
In my code, I have implemented OneToMany self-referencing relationship. I have initialized array collection in the constructor. When I send a query parent is added to the children. But when I try to ...
0
votes
1
answer
1k
views
How to loop an array collection to display in strings
I want to display in Twig a string list of "strenghts" for a "strategy" that I get in the controller with ParamConverter (there is a one to many relation, and "strenghts" ...
0
votes
2
answers
4k
views
Relation ManyToMany with Symfony 5 : do not save
For my project, I created 2 entities : Recipe & Ingredient. They are a ManyToMany relation.
mysql shema
I generated everything from the console (entity & CRUD). But, I can't save ingredients ...
-1
votes
1
answer
89
views
How can I get data from my ArrayCollection?
I am trying to load data from my array collection via doctrine:
$pages = $this->em->getRepository(Pages::class)->findAll();
The result is:
2 => Pages^ {#1598 ▼
-id: 3
-name: "cat"
-...
0
votes
0
answers
126
views
Symfony ArrayCollection
I have 2 entities:
Category and Article with the following relation:
Each Article has One Category.
Each Category may have Many Article.
The problem :
I want to add new category using this form :
...
-1
votes
1
answer
146
views
Symfony forms with multiple arrayCollection
Every user has multiple sports so I have created table users and table sports and table usersport.
I want that the user select multiple sport and store it in table user sport
user entity ...
-1
votes
1
answer
42
views
How can I display elements of my ArrayCollection working with joined Tables and ManyToMany relations?
In my entity documents I have a field called linkedDocuments:
class Documents {
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Documents")
* @ORM\JoinTable(name="documents_documents",
* ...
0
votes
1
answer
179
views
Could not determine access type for property "games" in class "App\Entity\GameGenre":
I have a Symfony 4.2 application. There are Entities Game and GameGenre. They have ManyToMany relation between each other. I am trying to load fixtures and receive the following error:
Could not ...
0
votes
3
answers
5k
views
How to deserialize XML to an object that contains an array collection in php Symfony
I have XML in the format
<POS>
<Source PseudoCCode="BOA" ISOCountry="US" AgentDutyCode="J114N">
<RequestorID Type="11" ID="T921">
<CompanyName Code="CP" ...
1
vote
0
answers
349
views
Why doesn't non doctrine-mapped ArrayCollection get initialized?
My Setup is a Symfony 3.4 App with the typical 'ManyToMany'-Relation with additional fields, something like this:
Entity Article
Entity Specialty
Entity ArticleSpecialtyRelation
In a Form for an ...
4
votes
1
answer
3k
views
Symfony expected must be an instance of Doctrine\Common\Collections\ArrayCollection, instance of Doctrine\ORM\PersistentCollection given
I am using Symfony 2.8
I have a many to many relationship between User and Sectors entities, the insertion works well but the creation of the edit form (the editAction function) does not work. All the ...
1
vote
2
answers
3k
views
How can I filter doctrine query by related id (Symfony 4)?
In my entity:
/**
* @ORM\ManyToMany(targetEntity="Productgroup", inversedBy="fields")
* @ORM\JoinColumn(name="productgroup", referencedColumnName="id")
*/
private $productgroup;
public ...
-3
votes
2
answers
2k
views
How can I store data in Array Collection with doctrine (Symfony 4)?
My controller:
/**
* @Route("/row/{slug}/{connect}/{field}/{productgroup}", name="row", methods={"POST"})
*/
public function row($slug, $connect, $...
-1
votes
1
answer
2k
views
How can I retrieve data from ArrayCollection (Symfony)?
animals:
| id | name |
|----|------|
| 1 | cat |
| 2 | dog |
| 3 | frog |
category:
| id | name |
|----|--------|
| 1 | green |
| 2 | blue |
| 3 | orange |
animals_category:
| ...
0
votes
2
answers
23k
views
How to sort Object Array Collection by value in PHP
So I have this result from database:
object(Illuminate\Support\Collection)#538 (1) {
["items":protected]=>
array(3) {
[0]=>
object(stdClass)#536 (3) {
["...
0
votes
2
answers
2k
views
Type error with ArrayCollection / OneToMany relationship in Symfony 3.4
For the past couple of days I have been trying to create a bidirectionnal ManyToOne-OneToMany relationship in Symfony 3.4
I have two entities. One is Contribution and the other is Source. A ...
1
vote
0
answers
215
views
Array Collection: How does the set method work?
This is maybe a stupid question but I can't figure it out...
I am trying to build a basic parent/child entity for a forum in doctrine. I have defined my entities and the relationship ManyToOne. I ...
0
votes
1
answer
3k
views
Doctrine update entity with arraycollection dont remove items
I have this classes:
AbstractBillingInvoice
/**
* @ORM\Table(name="billing_invoice")
* @ORM\Entity(repositoryClass="BillingBundle\Repository\AbstractBillingInvoiceRepository")
* @ORM\...
0
votes
1
answer
1k
views
Symfony 3.4: Issues on saving an Object ArrayCollection OneToMany
I need your help on my problem for saving my data in table.
I use fosUserBundle and have different user types (Admin, Pro, Client) that are classes extending a base User entity.
I also have a Language ...
0
votes
2
answers
1k
views
Symfony 3 : how to reordering an array collection with route action?
I have a Product Entity. Each product can have 0 or N pictures.
I have a ProductPhoto Entity which has a order property (0 = first).
On a page, I list all the pictures of my current product. I would ...
4
votes
2
answers
814
views
Symfony. After submit form does not contain a single element in the ArrayCollection for its fields from the CollectionType
My model contains two related classes - RealEstate and Image, and for one instance of RealEstate can be a lot of Image's instances. Since the Image class can also be used in association with other ...
0
votes
1
answer
380
views
symfony 3 can't persist arraycollections many to many from inverse side
I have 3 entities, army, weapon and unit. With army and unit I don't have any problem, but when I persist weapon (it is the inverse side of army and unit) doctrine saves all in the database except the ...