Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@koes anything not as centralized would be better. I mean you totally will have to do clear() as soon as you're doing more than a todo app or have some import/export functionalities.
Have fun optimizing this if your clear() clears each and everything without a way to only clear specific entities without consuming more memory (i.e. by keeping a list of entity ids or such)
Same goes for flushing. Flushing anywhere flushes everything. The fuck. How am i supposed to write clean code with this implied side effect everywhere.
Also, the whole cascading and when-is-an-entity-known stuff is confusing.
The Change-detection pattern sucks. Just give me persist methods, why this persist, maybe-persist, flush pattern?
Why are the find methods still just arrays instead of iterators/generators to this day?
And finally: I can't have the default value for columns managed via migrations. I somewhat get why and maybe this isn't really a doctrine problem, but it pissed me off even more. -
koes3301yI rarely use clear(), even for large applications. Only for batch processing really and it never bothered me how it works. Same with flush(). The flushing of individual entities was actually deprecated because this could potentially break data integrity (dealing with relational data). I get why some parts are complicated or annoying, but I can't think of a better ORM for PHP. Finally, about the defaults for migrations, I thought this was possible by setting the default on a property using annotations, am I wrong?
-
@koes i think i might be a bit biased after using gorm (golang) for a while, which made more sense to me. There, you're working with a manager which can process entities.
Doctrine feels like a manager that knows entities and magically works ...or fails.
I don't know anything better in the PHP landscape of things, either tbh.
Well you can, but it's not managed by doctrine then. So it's there and (not sure about that part) not even written into the db. At least adding it in (-> ALTER) didn't spawn a new migration. -
koes3301yThis this?
<?php
#[ORM\Entity]
class myEntity {
#[ORM\Column(options: ["default" => 0])]
private int $myColumn;
// ...
} -
@koes I tried something along the lines of RAND() but yes, that's more or less what I was trying.
Related Rants
Doctrines design sucks ass.
rant
php
symfony
doctrine