Skip to main content

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
4 votes
2 answers
636 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 ...
0 votes
1 answer
134 views

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 ...
3 votes
1 answer
787 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 ...
-1 votes
1 answer
37 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 ...
1 vote
1 answer
85 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 <...
5 votes
1 answer
545 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 ...
3 votes
1 answer
57 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. ...
2 votes
1 answer
117 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: ...
2 votes
0 answers
41 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 ...
2 votes
1 answer
248 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, ...
0 votes
1 answer
72 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? ...
2 votes
1 answer
961 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? ...
2 votes
0 answers
385 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 ...
0 votes
1 answer
176 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: ...
5 votes
3 answers
214 views

Get similar posts with manyToMany relationship

I have a table post with a many-to-many relationship with the tag and product tables. ...
4 votes
1 answer
52 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 ...
11 votes
2 answers
14k 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: ...
4 votes
0 answers
199 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 ...
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-...
1 vote
1 answer
211 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 - ...
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 ...
6 votes
2 answers
838 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 ...
2 votes
1 answer
266 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 ...
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 ...