Get the block table data not only by bID
Permalink
I have an external form. This form records data on a table with bID and uID as primary keys. On block's controller I've overridden the save() method where I manually set the uID with the one of current user before call the parent::save. In this way Insert/Update goes fine.
Now I need to do something similar when block is loaded. I mean load the right table row not only by bID (as done as default) but by bID and the specified uID. Any idea?
Thank you!
Now I need to do something similar when block is loaded. I mean load the right table row not only by bID (as done as default) but by bID and the specified uID. Any idea?
Thank you!
I can post the code but it's nothing special.
Instead, I found this code on block_controller.php costructor that I partially copied and used in my form controller __costructor:
it works as I asked but the "problem" is that in this way I've however to load the entire table instead of the only required row.
Instead, I found this code on block_controller.php costructor that I partially copied and used in my form controller __costructor:
__costructor($obj = null) { parent::__construct($obj); $this->user = new User(); $this->record = new BlockRecord($this->btTable); // $this->record->bID = $this->bID; $this->record->uID = $this->user->getUserID(); // uID is unique $this->record->Load('uID=' . $this->user->getUserID()); $this->load(); }
it works as I asked but the "problem" is that in this way I've however to load the entire table instead of the only required row.
If that doesn't help, can you ZIP up the block code and post that here?