Generating from xml File

Hello everybody,

i programmed all the time with CakePHP 2.5.
Now I switched to 3.2 and have a problem which i don´t get solved.

The goal is an dynamic XML file which is needed for a videoplayer

In version 2.5, i could do this in the controller with following lines

public function genxml($id = null) {
if (!$this->Video->exists($id)) {
throw new NotFoundException(__(‘Invalid video’));

$this->RequestHandler->renderAs($this, 'xml'); 
$options = array('conditions' => array('Video.' . $this->Video->primaryKey => $id));
$this->set('video', $this->Video->find('first', $options));


Unfortunately this does not work in version. 3
Here I have used following lines, but I did not lead to the result which I achieved.

public function genxml($id = null) {
$this->RequestHandler->renderAs($this, ‘xml’);

$video = $this->Videos->get($id);
$this->set('video', $video);
$this->set('_serialize', ['video']);


What should I do to certain values ​​in a pre-XML file query is then generated as an XML file?

Thank you for your help before starting.