neat-php / object

Neat Object components
MIT License
4 stars 1 forks source link

Repository method rename #2

Closed baukevdw closed 6 years ago

baukevdw commented 6 years ago

Rename the repository methods so that they match the method names of other neat components

findById() --> oneById() byId()?

iterateAll() --> iterate() iterateAll() collection() --> collect() collectAll() collection()?


- [x] Rename methods
- [x] Fix tests
annavanbiemen commented 6 years ago

I'd go for:

exists() -> has()
findOne() -> get()
findById() -> get()    (just pass an integer id as conditions)
findAll() -> all()
iterateAll() -> iterate()

collection() is just fine IMO. It clearly indicates the output from the method, while collect() doesn't.

The exact same naming should also be reflected in the Entity(Trait).

annavanbiemen commented 6 years ago

Furthermore there's an inconsistency in toArray, fromArray and createFromRow, createFromRows. Array? Row? These names are inconsistent and maybe longer than required.

createFromRow could be just create and is createFromRows actually used/needed?