Using_Lazy_Loading - TransferORM/transfer GitHub Wiki

Lazy Loading

If the attribute of 'lazy' is set one a 'manytoone', 'onetomany' or 'manytomany' element, the items that are stored in that composition are lazily loaded into the object.

This means that when the object is first generated from the database, these records are not retrieved with the initial load.

Only when a function that has been generated for the lazy composite element, such as 'get*Array()' or 'contains*()', is called that the required information is retrieved from the database, and the resulting object(s) are loaded.

For example:

<object name="Foo">
	<id name="idbasic" type="numeric"/>
	<property name="bar" />
	<onetomany name="child" lazy="true">
		<link to="Bar" column="FKBarID"/>
		<collection type="array">
		</collection>
	</onetomany>
</object>

It should be noted that the entire collection is loaded when requested, not just the singular object requested. If you are looking at more granular control over loading, you may wish to look at Using TransferObject Proxies

⚠️ **GitHub.com Fallback** ⚠️