Fixed duplicated tags creation

Change-Id: I59100984ed54aad9f2c1b1fb3c0331065ecb4e29
This commit is contained in:
smarcet 2019-09-09 17:57:21 -03:00
parent aecde32468
commit 08e644a434
2 changed files with 14 additions and 2 deletions

View File

@ -59,7 +59,8 @@ final class DoctrineTagRepository
->from(\models\main\Tag::class, "t")
->where('UPPER(TRIM(t.tag)) = UPPER(TRIM(:tag))')
->setParameter('tag', $tag)
->getQuery()->getFirstResult();
->setMaxResults(1)
->getQuery()->getOneOrNullResult();
}
catch(NoResultException $e){
return null;

View File

@ -73,12 +73,23 @@ final class VanderpoelScheduleFeed extends AbstractExternalScheduleFeed
'start_date' => $event['start_timestamp'],
'end_date' => $event['end_timestamp'],
'speakers' => $speakers,
'tags' => utf8_encode($event["keywords"])
'tags' => self::encode_array($event["keywords"])
];
}
return $events;
}
private static function encode_array($array){
if(is_array($array)){
$res = [];
foreach ($array as $element){
$res[] = utf8_encode($element);
}
return $res;
}
return $array;
}
public function getSpeakers(): array
{
return $this->speakers;