Open ghost opened 8 years ago
Have you tried to parse data with Transformer instead of using Mutator ?
@tucq88 Sorry for my late response but no, i didn't tried this.
Actually, we decided to produce our own repository pattern implementation, since we found that this package has some bugs and it's preventing us to continue.
We're also figuring out that we should not use any repository pattern within Eloquent. Instead, we are growing the idea of use the original Query Builder or Doctrine 2. I think it will have a much better design and easy of understanding.
oh... no worry mate, It's me need to thank you for your reply. That's pretty critical to me. I just started using this package but it seems like it's not under active development and contains many unresolved issues.
But I'm confused with your idea about using original Query Builder. Because the idea of using Repository is to abstract the database layer so if I need to change the DB like from MySQL to Postgres or MongoDB I just need to change my base repository methods. Could you share me more about your ideas ? Would love to talk more about that.
@tucq88 I think Query Builder or Doctrine 2 will provide an repository implementation with more control over the code. Eloquent has to many magic and it's difficult to provide an interface that can handle it together within others AR's and ORM's. That's why all packages i already saw supports Eloquent only.
On the otherside, Eloquent has a lot of great features. An implementation without it will need a lot of work to handle some simple stuffs already handled by it.
Of course i'm only throwing thoughts in here, this needs to be studied. Recently, a new repository pattern package for laravel was created by Rinvex: https://github.com/rinvex/repository. They are implementing using Eloquent too. I'll check it out any soon.
@ricardovigatti Thanks mate. Actually I'm not quite familiar with Query Builder & Doctrine 2 so I was kind of nervous, but your answer encourage me to check them out. Cheers.
Give a try to Rinvex's package first, seems to be evolving very well and fast.
+1
+1
I have an attribute named as "dtinicio" who is casted to date by my model:
My application uses the format "d/m/Y" by default, so i've implemented the mutator at the model:
MyRepository extends BaseRepository from this package, and i've implemented the $rules as documented.
I'm facing issues trying to create or update those values because BaseRepository is changing the format, in the methods "create()" and "update()", just before the call on validator.
The error appears even if i remove the rule for dtinicio, the only way to pass through it is disabling the validator completely from this repository.
I think it's related to #120.