Hey,folks.
I am building a website using silverstripe at this moment. But i am still a newbie :(
I met the problem with Dataobject::get() again.
The data table relationship lists below:
one ListingPage has many ListingImages
static $has_many=array(
'ListingImages'=>'ListingImage'
);
one ListingImage has one Attachment(image)
static $has_one=array(
//parent
'ParentListingPage'=>'ListingPage',
'Attachment'=>'MyImage');
MyImage extends Image Type.
OKay. the things i want is to select all the ListingImages where ListingPage id=current Listing page id. and furthermore, I want to access the URL of each Attachment. So, i set of URL of the Images' Attachment of the current Listing page is what i want by doing the Dataobject query.
function PictureData(){
$id=$this->ID;
$data=DataObject::get('ListingImage',"ParentListingPageID=$id);
}
i can select all the ListingImage using the function above, but not sure how to further query the content in ListingImage and grab the URL back.
If i could be able to get the ListingImages' URL, i think i could use the foreach loop through the URL sets and output as what i want.
Any Suggestions, really appreciate.