cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR]: Global variable for reusable in ORM

Open zak-wojtek77 opened this issue 6 years ago • 6 comments

In every model every relationship does not use cache. If I want to use cache I have to write 'reusable' => true:

$this->hasOne(
            'inv_cst_id',
            Customers::class,
            'cst_id',
            [
                'alias'    => 'customers',
                'reusable' => true,
            ]
        );

My proposal: add new global option: phalcon..orm.reusable = false if I don't write in relationship "'reusable' => true" but I write phalcon..orm.reusable = true then will be the same like I write "'reusable' => true".

Priority of global variable would be less than option "reusable" written in relationship.

zak-wojtek77 avatar Jan 29 '20 09:01 zak-wojtek77

The offer is good, but dangerous

TimurFlush avatar Jan 29 '20 14:01 TimurFlush

why dangerous?

zak-wojtek77 avatar Jan 29 '20 14:01 zak-wojtek77

@zak-wojtek77 A very large amount of data from the DBMS may get into the cache. If you do this thing, you should turn it off by default.

TimurFlush avatar Jan 29 '20 15:01 TimurFlush

I agree with @TimurFlush. This can be abused if set to true by default.

niden avatar Jan 30 '20 04:01 niden

Closing in favor of https://github.com/phalcon/cphalcon/issues/14608

Please vote for this feature there

niden avatar Jan 30 '20 04:01 niden

I agree with @TimurFlush. This can be abused if set to true by default.

Of course by default it should be 'false'.

zak-wojtek77 avatar Jan 30 '20 07:01 zak-wojtek77