Skip to content
Snippets Groups Projects
Commit 50cbc4a4 authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

Merge branch 'hotline#189358_fix_mapetitemediatheque_php8' into 'master'

[RTfixed] hotline#189358 : fix MaPetiteMediatheque imports in PHP8

See merge request !4859
parents 35a7d224 1d86cdca
Branches
Tags
1 merge request!4859[RTfixed] hotline#189358 : fix MaPetiteMediatheque imports in PHP8
Pipeline #27474 passed with stage
in 19 minutes and 21 seconds
- correctif #189358 : Cosmogramme : correction de l'intégration des albums ArteVOD pour PHP8.
\ No newline at end of file
......@@ -100,6 +100,14 @@ class ArteVod_Service_Film
return $album->setTypeDocId(ArteVod_Config::getInstance()->getDocType());
}
protected function _addAuthor(Class_Album $album, $actor) : self {
$family_name = trim(is_array($actor) ? ($actor['familyName'] ?? '') : $actor);
$given_name = trim(is_array($actor) ? ($actor['givenName'] ?? '') : '');
$author = $family_name . ($given_name ? ' ' . $given_name : '');
$album->addAuthor($author, '005');
return $this;
}
public function fillAlbum(Class_Album $album) : self {
$this->setTypeDoc($album)
......@@ -110,8 +118,8 @@ class ArteVod_Service_Film
$this->_fillDirectorIn($album, $director);
foreach ($this->getActors() as $actor)
$album->addAuthor(trim($actor['familyName'] . ' ' . $actor['givenName']),
'005');
$this->_addAuthor($album, $actor);
return $this;
}
......
......@@ -48,12 +48,16 @@ class MaPetiteMediatheque_Service extends Class_DigitalResource_Service {
protected function _parseFilm($movie) {
if (isset($movie['id'])) {
$this->_films[] = (new MaPetiteMediatheque_Service_Album($movie))->setConfig($this->_config);
return $this;
}
if ( ! isset($movie['id']))
return $this->_parseSeasons($movie);
$movie['actors'] = ($actors = $movie['actors'] ?? '')
? [$actors]
: [];
return $this->_parseSeasons($movie);
$this->_films[] = (new MaPetiteMediatheque_Service_Album($movie))->setConfig($this->_config);
return $this;
}
......
......@@ -198,6 +198,13 @@ class MaPetiteMediathequeHarvestTest extends MaPetiteMediathequeActivatedTestCas
}
/** @test */
public function firstAlbumAuthorShouldContainsCharlieChaplin() {
$chaplin = Class_Album::find(1)->getAuthors()[1];
$this->assertContains("Charlie Chaplin", $chaplin->getLabel());
}
public function cacheCacheProperties() {
return [['description', 'Deux petits ronds de couleur'],
['external_uri', 'https://www.ma-petite-mediatheque.fr/?content-id=content-21&type=lire'],
......
......@@ -42,6 +42,7 @@
"largeUrl": "http://image-resize.lab.arte.tv/HCCGzS1qEouURSNlj4f4eAM_MHY=/1200x0/https%3A%2F%2Fs3.eu-west-1.amazonaws.com%2Fbayard.tv%2Fmovies%2FDATA%2FBDTU0002FR%2FIMAGES%2FBandeau.jpg"
}
],
"actors": "Charlie Chaplin",
"trailers": [],
"title": "Cache-cache - Hervé Tullet",
"description": "Deux petits ronds de couleur, “Oh !” et “Ah !” jouent à cache-cache dans une drôle de forêt. Quand soudain, un troisième joueur arrive… Une aventure des petits ronds d’Hervé Tullet qui met en scène la vitalité des enfants.",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment