Skip to main content

Models

A number of model classes are provided to format data for pages and ensure a consistent interface when accessing data from different areas of the application.

The attributes of the model are accessed using getter and setter functions in PHP. Calls to setter methods can be chained for ease of use.

<?php

namespace Photon\CmsEngine\Model\Element;

class Article
{
/**
* @var Link
*/
private $link;

/**
* @param Link $link
*
* @return Article
*/
public function setLink($link)
{
$this->link = $link;

return $this;
}

/**
* @return Link
*/
public function getLink()
{
return $this->link;
}
}

You can use a dot (.) to access attributes of a model variable in twig

{{ article.title }}
{{ article.link.url }}