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
0 votes
1 answer

Validating an input in a chatbot

Is this a good approach for validating user input in a chatbot? I am writing an autoposter telegram bot in PHP using the php-telegram-bot library (by Longman). I have a Task class that stores ...
Gigoshkin's user avatar
-1 votes
1 answer

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 ...
Jonathan Clark's user avatar
1 vote
1 answer

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 <...
jikaill's user avatar
  • 13
3 votes
1 answer

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

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 ...
NanoPish's user avatar
  • 173
2 votes
1 answer

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: ...
jcarlosweb's user avatar
2 votes
1 answer

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? ...
Bob's user avatar
  • 21
4 votes
2 answers

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 ...
Keramik's user avatar
  • 71
0 votes
1 answer

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: ...
Kakashi's user avatar
  • 203
0 votes
1 answer

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? ...
user112006's user avatar
2 votes
0 answers

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 ...
danbroooks's user avatar
5 votes
3 answers

Get similar posts with manyToMany relationship

I have a table post with a many-to-many relationship with the tag and product tables. ...
Max Lipsky's user avatar
3 votes
1 answer

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 ...
Jonathan K.'s user avatar
4 votes
1 answer

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 ...
jmack's user avatar
  • 43
11 votes
2 answers

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: ...
Mollo's user avatar
  • 211
4 votes
0 answers

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 ...
kitensei's user avatar
  • 141
6 votes
1 answer

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-...
AlexMA's user avatar
  • 191
5 votes
1 answer

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 ...
k0pernikus's user avatar
2 votes
1 answer

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 ...
user1578653's user avatar
1 vote
1 answer

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 - ...
Faery's user avatar
  • 269
2 votes
1 answer

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 ...
Kristof's user avatar
  • 123
2 votes
1 answer

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, ...
Jesse Bunch's user avatar
10 votes
1 answer

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 ...
BenV's user avatar
  • 897
6 votes
2 answers

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 ...
BenV's user avatar
  • 897