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
-
garrettw2648yHow so? I'm not familiar with how Laravel does things.
I'm asking because I know a guy who has developed an ORM that uses stdClass objects.. -
garrettw2648y@chasb96 Care to give your opinion on this library I was just referring to?
https://github.com/Level-2/Maphper
I was planning on using it in one of my projects but haven't actually gotten to the point of using it yet. -
garrettw2648y@hrombach I considered Doctrine at one point, but it's not the only "real" option. Let's not be biased.
-
hrombach1788y@garrettw that is why I said "like". I just don't like nondescript stdClass objects, they're not much more useful than arrays. What I meant was to use an ORM that uses structured classes and actually maps values to properties.
-
garrettw2648y@hrombach I agree that stdClass objects aren't much different than arrays. Actually an array is more useful as it is iterable whereas stdClass is not (as you can't make it extend ArrayObject or ArrayAccess). Plus there are tons of array helper functions in PHP.
(Actually you could iterate over stdClass properties but it's not nearly as easy - it involves a lot of reflection.)
However, when comparing arrays or stdClass objects to concrete class objects, there's this:
https://github.com/Level-2/Maphper/... -
hrombach1788y@garrettw concrete class structures yield huge advantages though when you're using a more complex ORM, like, say, Doctrine2. (I would give you more examples but personally I've only ever used Doctrine)
Related Rants
stdclass arrays of php are a good solution to work with data from the database but sometimes they can be a pain in the ass...
undefined
db
laravel
array
arrays
database
php