Questions tagged [doctrine]

The Doctrine Project is a collection of open source libraries and tools for dealing with database abstraction and Object-Relational Mapping written in PHP.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
31 views

Find qualifications that are expiring [closed]

I have the following function that returns StaffQualifications where either the qualification is expiring or the qualification type is expiring, but this section doesn't seem to sit well with me as it ...
user avatar
1 vote
1 answer
46 views

Symfony rest endpoint for get a number products of one user

I want to improve quality of this symfony rest endpoint (solid principle, Kiss, best practice...) Can you review my code please? Symfony controllController function that return json list of product <...
user avatar
  • 13
1 vote
0 answers
44 views

PHP Doctrine - shared properties between discriminator classes

I have a single table inheritance type on a class (Resource) that can be one of 3 classes: SingleDay MultiDay Accommodation SingleDay has properties: QTY ...
user avatar
3 votes
1 answer
48 views

Forum system implementation

I have a function which does the following: When new Post Entity is added some fields in Category table are updated. When new Thread Entity is added the same fields in Category table are updated. ...
user avatar
2 votes
0 answers
35 views

Many to many (n to m) relationship without insert duplication php

I managed to make a many to many relationship work correctly using mysql, doctrine 2 and symfony 3.4. When a new element A that contains 0 to m element Bs is inserted, the B elements that already ...
user avatar
  • 173
2 votes
1 answer
105 views

Model database for contract renewal

I have made a contract renewal system in Symfony and Doctrine, and it works, but I think it can be improved, but I make too many requests to the database. These are my models: ...
user avatar
2 votes
1 answer
880 views

Doctrine/Symfony WHERE clause for reports

I'm trying to generate a report from two doctrine entities. The fields to filter the report are optional. This is the code I've got now and it looks really bad to me. How can I improve this? ...
user avatar
  • 21
4 votes
2 answers
575 views

TodoList in Symfony 3

This little project is about working with doctrine Entity object and everything is working fine. This is my first project in Symfony 3. Please review my service file and give me some advice to ...
user avatar
  • 71
0 votes
1 answer
166 views

Repository code in Laravel

I am practicing to code in the right way and make it testable. Please review this code and tell me anything bad practices of it. Entity: ...
user avatar
  • 203
0 votes
1 answer
68 views

Updating data on a blog

I want to make post editing on my blog. I get data from a form and want to put it into a database. I'm not sure if using setters is the best way, so maybe you can show me better solution? ...
user avatar
1 vote
0 answers
279 views

Inheritance and Association implentation in Symfony 2.7 and Doctrine

I've a working implementation in Symfony2 with doctrine of the following model. A Parent can apply for one/more Training(s) A Training is based on a specific Skill, but you can have multiple ...
user avatar
  • 123
2 votes
0 answers
363 views

PHPSpec, testing code that uses fluent mock

I've just completed writing a spec for a Doctrine2 repository. The repo contains only one method so far, the spec for which takes in an OAuth Identity token object (that contains an ID that matches up ...
user avatar
5 votes
3 answers
189 views

Get similar posts with manyToMany relationship

I have a table post with a many-to-many relationship with the tag and product tables. ...
user avatar
1 vote
0 answers
88 views

Util method for generating an INSERT sql dynamically

I'm currently building software that: 'talks' to Google Analytics API, fetches data, persists the data to a MySql db. Insertion of data into the db needs to happen automatically - based on the ...
user avatar
  • 185
2 votes
0 answers
694 views

Selecting random results within Doctrine

I'm new to Doctrine and had a hard time deciding how to get random rows within it without creating custom DQL functions or using a native query. The solution I have come up with is below, this is ...
user avatar
4 votes
1 answer
49 views

Inserting and updating data for a website monitoring app

I have created an app in which URLs stored in a database are pinged via curl to check their availability and the database is updated with the results. Two tables are updated with each fresh ping of a ...
user avatar
  • 43
10 votes
2 answers
13k views

Fetching objects and adding a calculated field in Doctrine 2

I'm making a section that shows a list of blogs and how many comments it has without loading any comment data. My Blog entity is as follows: ...
user avatar
  • 201
4 votes
0 answers
198 views

Zf2 and doctrine model implementation

I've implemented for the first time Doctrine-ORM on my SOAP server application; can you tell me if I could optimize some of the written ORM-related code? More specifically, is it a good practice to ...
user avatar
  • 141
6 votes
1 answer
3k views

Ugly code unit testing with PHPUnit and Doctrine2 (an ORM)

I am trying to unit test a small class that I consider part of the "business-logic" layer of my project. It mostly just interact's with Doctrine's entity manager and a couple of entities with a many-...
user avatar
  • 191
5 votes
1 answer
407 views

Filtering queries based on the current user state

I have a Symfony2 project. I have an Entity Asset which can have relations with Category. I store a ...
user avatar
1 vote
0 answers
360 views

Zend Framework and Doctrine 2 - are my unit tests sufficient?

I'm quite new to Zend and unit testing in general. I have come up with a small application that uses Zend Framework 2 and Doctrine. It has only one model and controller and I want to run some unit ...
user avatar
2 votes
1 answer
5k views

Advice on Zend Framework 2 and Doctrine

I've just started looking at Zend Framework 2 and Doctrine ORM, with a view to possibly using it in one of my future products. So far I have a very simple application which allows the user to select ...
user avatar
1 vote
1 answer
210 views

Database "design" using Symfony2 and Doctrine2

I'm working on an application, which tracks expenses. I have users, and each user can create his categories for the expenses (like Food, Bills, Transport, Drinks, Clothes) and then create expenses - ...
user avatar
  • 269
2 votes
1 answer
263 views

Passing a large amount of diverse information in JSON using Symfony 2.1 and Doctrine 2

For a project I need to give a load of diverseinformation in JSON format. All the information will be used on the same page so a single call would result in the least overhead. The information all ...
user avatar
  • 123
2 votes
1 answer
232 views

Use case interactor

Here is a class that executes the CreateAPerson use case. It takes a request object (which is a simple data structure), validates the request, creates a new person, ...
user avatar
10 votes
1 answer
2k views

Php/Doctrine array hydration

According to the Doctrine docs, you should use Array hydration rather than record hydration when retrieving data for read-only purposes. Unfortunately, this means I have to use array syntax (as ...
user avatar
  • 887
6 votes
2 answers
825 views

PHP/Doctrine bootstrap for review

Here's my bootstrap.php for my PHP/MySQL/Doctrine app. It's my first PHP app so I'm interested in learning from the experience of others how this could be improved ...
user avatar
  • 887