Skip to main content
8 votes
Accepted

A demonstrational example of a Data mapper ORM

I don't fully understand the desire for a "generic" data mapper. Oftentimes, flexibility leads to complexity and fragility in your application. Take for example your ...
Mike Brant's user avatar
  • 9,638
6 votes

Building a simple ORM in PHP

One thing I believe is obvious is that your ORM is subject to SQL injection unless I am missing something. For example, in my understanding, you could make something like this ...
Carlos's user avatar
  • 61
4 votes
Accepted

Unit testing a REST API in Go

OK, so a bit later than I expected, but here's some comments I have. I'll try to address the concerns you list to a reasonable degree: I didn't manage to mock DB, that's why I am using an in-memory ...
Elias Van Ootegem's user avatar
4 votes

Unit testing a REST API in Go

Here are some notes I made while reading your code. For a real-world code review, code should be correct, maintainable, reasonably efficient, and, most importantly, readable. Writing code is a ...
peterSO's user avatar
  • 3,531
3 votes

A demonstrational example of a Data mapper ORM

I'm not sure if it was intentional but it appears that for the most part PSR-2 is being followed, except that in save() the opening braces for the control ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes

A simple User class

The comment by mferly is very constructive: Comment your code/methods/properties/everything. Seriously. In your getUsers() method, is the ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes
Accepted

Password field based on peewee ORM framework

All in all, I find the code very well written. I don't really understand the purpose of the Argon2Hash.create class method, but I'd venture it is for convenience ...
301_Moved_Permanently's user avatar
3 votes

Building a simple ORM in PHP

I am particularly interested in how ORMs really work, but not succeeded with writing an exemplary mapper yet. So I am really interested in your approach, which is quite good to my taste, save for ...
Your Common Sense's user avatar
3 votes

Inventory Management System

This is a very naive approach to the issue and it's a race condition away from being a day+ debugging nightmare for you. ...
Javier Buzzi's user avatar
3 votes

Inventory Management System

Avoid premature optimization ...
tdy's user avatar
  • 2,176
2 votes

Rails model for aggregate data instead of a real table

I agree with you that this does not really fit a service nor a model. This might be more like a Query object. ...
Christian Bruckmayer's user avatar
2 votes

Unit testing a REST API in Go

You can simplify your build and allow for easier integration tests* with a docker-compose.yml file. ...
Eyal's user avatar
  • 309
2 votes

Inventory Management System

looking for some feedback We have some nouns, here. I don't see any verbs. Certainly there is no test suite. It's unclear what entrypoint someone would use to exercise this codebase. I imagine there ...
J_H's user avatar
  • 34.8k
1 vote

Validating an input in a chatbot

I think the best option is to implement the validate function inside task class. It should be a behaviour of the task class. And why don't you use polymorphism here? You have ...
Kevin's user avatar
  • 109
1 vote

Object relational mapper - optimize in memory data representation and code improvements

It's not related to your four questions but the most important thing for me is that your library is not (yet) an ORM from my point of view. An ORM is supposed to map Object and it's properties to a ...
jona303's user avatar
  • 151
1 vote

django multiple if else refactor

Well finally I ended up with the following, I changed some names to make it more explanatory and the function to respond to an ajax request. However the logic is pretty much the same: ...
Laycoonz's user avatar
  • 123
1 vote
Accepted

Flask Database Design with ORM

At the end of the day I used pandas. df = pandas.read_sql_query("""My join query""") This all just solved my problem.
alkanstein's user avatar
1 vote

PHP - Saving inbound email and its attachment

It can be more efficient It seems okay to use the create() method to insert a document record. However, for the sake of efficiency there is a method to create ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Displaying a user profile based on a mock ORM

Pages You can get rid of a lot of boilerplate with constructor promotion (PHP 8.0): ...
Laurel's user avatar
  • 678

Only top scored, non community-wiki answers of a minimum length are eligible