ClassModelList::loadXref()

Deprecated

Please use the Relations instead.



This function is a great support to automatically populate a new array property in the item(s) containing a cross-reference list.

N:M dump object



Instance a crossed list

The following example explains the function declaration.

loadXref() must be called from populateObjects() of the model (item model or list model)

In case of an item model, the declaration varies. $items becomes $item.

N:M Foreign Keys load Xref Cook

Context

The given context is deciding wich columns are loaded in memory (SQL query).
It must exist in the xrefTable (visits)

If you haven't created 'object.default', then create it in prepareQuery() or use an existing profile :

[view].[template]

The N:M tutorial is putting as this in pratice.



Usage in component

Per default, the Xref list is not loaded in the model.
When you want to load it, just use the state var: xref.[objectField]

$model->setState('xref.cities', true);

You can change model state only BEFORE getItem() 
Once getItem() or getItems() has been called, the states vars cannot anymore affect the SQL query because it has already been used and requested.



Note of the conceptor

In case of list, it does globally the same job than item for the moment, but it will be impoved and optimized in future. A SQL is actually requested for every row. It could be optimized to load all concerned items at once and then dispatch them into their respective parents.

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started