codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

5 new methods: undelete, set_restriction, get_primary_value, join, without_callbacks and with inside with

Open julienmru opened this issue 10 years ago • 3 comments

undelete: pretty self-explanatory, works only when soft deleting is enabled set_restriction: use-case: controller’s constructor loads a model, adds a restriction (eg. “user_id = 123”), subsequent calls to the model add the restriction to all the queries. Think of it as an easy built-in security which removes the need to add the same where clause again and again on all methods. get_primary_value: gets the current primary key value, useful in observers join: performs a direct ActiveRecord join with now accepts a second parameter which behaves like a with() inside the get() without_callbacks: temporarly disable callbacks

julienmru avatar Aug 06 '14 15:08 julienmru

This pull request also fixes #87.

julienmru avatar Aug 07 '14 11:08 julienmru

Hi Julien,

Thanks for your PR and email. I promise I'll take a look soon, I'm just manically busy at the moment – I'll get in touch when I've got enough time to sit down and take a proper look.

J

On 7 August 2014 12:28, Julien Tessier [email protected] wrote:

This pull request also fixes #87 https://github.com/jamierumbelow/codeigniter-base-model/issues/87.

— Reply to this email directly or view it on GitHub https://github.com/jamierumbelow/codeigniter-base-model/pull/180#issuecomment-51459823 .

Jamie Rumbelow [email protected]

jamierumbelow avatar Aug 08 '14 10:08 jamierumbelow

I changed something in with_deleted(): contrary to the var name, it was not temporary and was maintained between calls. I'm not sure if it was on purpose or not, but this is changed: with_deleted() only works for the current call.

julienmru avatar Aug 11 '14 10:08 julienmru