So I have a TestimonialPage, which has Testimonial dataobject as a has_many relationship. The Tesitmonial also has a Tour page type as a has one relationship. This Tour page type already exists.
TestimonialPage.php
class TestimonialsPage extends SmartPage {
...
static $has_many = array(
'Testimonials' => 'Testimonial'
);
...
}
Testimonial.php
class Testimonial extends DataObject {
...
static $has_one = array(
'Image' => 'Image',
'TestimonialsPage' => 'TestimonialsPage',
'Tour' => 'Tour'
);
...
}
On the TestimonialPage template, I am looping Testimonials and displaying them. Works fine. Until I attempt to access any of the properties in the linked Tour object:
TestimonialPage.ss
<% if Testimonials %>
<% control Testimonials %>
$Tour.Title // Doesn't display anything
<% end_control %>
<% end_if %>
Is that even possible? There is no relationship linking to the Testimonial object from Tour, as it's rather optional.