[rt-users] Differences in files/filenames

Stephen Turner sturner at MIT.EDU
Wed Nov 22 09:34:42 EST 2006


> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Mathew Snyder
> Sent: Wednesday, November 22, 2006 1:50 AM
> To: rt-users at lists.bestpractical.com
> Subject: [rt-users] Differences in files/filenames
> 
> I'm trying to sort through lib/RT in order to figure out how to write
> scrips/scripts.  I read the RT Essentials book but didn't see 
> anything that
> describes the differences between files such as 
> CustomFieldValue.pm and
> CustomFieldValues.pm.  More importantly, the _Overlay.pm 
> files since, I think,
> those are the files with the actual functions I'll be 
> incorporating into my
> scrips/scripts.
> 
> Thanks
> Mathew
> _______________________________________________

Mathew,

A couple of things to know about the perl code:

A CustomField object is handled by CustomFieldValue.pm and
CustomFieldValue_Overlay.pm - when you make a new CustomField object in your
perl code, the object gets attributes & methods from both of these files. If
a method is defined in both files, the version in _Overlay is the one that's
effective. Generally, the Overlay file is the one with the intersting stuff
in it. 

The file names that are singular (e.g. CustomFieldValue.pm) represent a
single object (row in the database) and are usually based on the generic
RT::Record object. In your perl code you usually populate these objects by a
Load method or as the result of a method call on another object. 

The file names that are plural (e.g. CustomFieldValues.pm) represent a
collection of objects - in this case a collection of CustomFieldValue
objects. They are usually based on the generic SearchBuilder object and are
populated by a database query that returns multiple rows (e.g. by limiting
and then iterating through the collection).

Hope this is useful,
Steve

----------------------------------------
Stephen Turner
Senior Programmer/Analyst - Client Support Services
MIT Information Services and Technology (IS&T)
  




More information about the rt-users mailing list