I excidently posted this with an error before
this should work
function find($type, $queryData = array()) {
if(isset($queryData['index'])) {
if($queryData['index'] === true) {
$index_path =
'{n}.'.$this->alias.'.'.$this-
hey there...
this is what i have been looking for...
but there is a small problem... i am using it on a model which is
belongs to another model.
with a normal find('all') i get this result..
[0] => Array
(
[Model1] => Array
(
[a] => 0
I included this
function find($type, $queryData = array()) {
if(isset($queryData['index'])) {
if($queryData['index'] === true) {
$index_path =
'{n}.'.$this->alias.'.'.$this->primaryKey;
} els
The only thing I might add is to write a custom method in your model to do
this find and reindexing.
At least then, hopefully, when (if) this becomes possible, the refactoring
is a heck of a lot easier and should result in code removal with no change
to controllers.
In fact I've found myself purg
too bad that there is no way to do it.
I'm currently doing it exactly the way you suggested but I was hoping
for an easier solution.
It get's a bit more difficult when you want the associated data to be indexed.
But especially it is not so nice because it does affect performance
On Tue, Sep 2, 20
It is not possible, but you can always extend the find() method in
your Appmodel if you require that funcionality often:
class AppModel extends Model {
function find($type, $params)
switch ($type) {
case 'indexed' : return Set::combine($this->find(...), '...');
default: return parent::
Hi,
Currently find('all') will return an array that is indexed by integers
in the order of how the records were retrieved.
Is there any way that I can make find() return an array that is, for
example, indexed by the primary key of the data that is being
retrieved?
I need to access that like this