<commit_before><?php

namespace Mind\MediaBundle;

use Doctrine\Bundle\DoctrineBundle\Registry;
use Symfony\Component\Security\Core\SecurityContextInterface;


class Avatar extends \Twig_Extension {
    
    protected $doctrine;
    protected $manager;
    protected $security;
    
    public function __construct(Registry $doctrine, SecurityContextInterface $security) {
        
        $this->doctrine         = $doctrine;
        $this->manager          = $doctrine->getManager();
        $this->security         = $security;
    }
    
    public function getAvatar($idUser){
        
        $avatar = $this->manager
                       ->getRepository('MindMediaBundle:Avatar')
                       ->findOneBy(array('idUser'=>$idUser));
        
        return $avatar;
    }
    
    public function supprimerAvatar($idUser){
     
        $avatar = $this->manager
                       ->getRepository('MindMediaBundle:Avatar')
                       ->findOneBy(array('idUser'=>$idUser));
        if(!empty($avatar)){
            if($avatar->getPath() == "../web/img/avatar-femme.jpeg " or $avatar->getPath() == "../web/img/avatar-homme.jpeg " ){
                
            }else{
                $this->manager->remove($avatar);<commit_msg>- corection d'un bug : correction pour éviter que l'avatar par defaut d'un user soit supprimer lors de la modification<commit_after><?php

namespace Mind\MediaBundle;

use Doctrine\Bundle\DoctrineBundle\Registry;
use Symfony\Component\Security\Core\SecurityContextInterface;


class Avatar extends \Twig_Extension {
    
    protected $doctrine;
    protected $manager;
    protected $security;
    
    public function __construct(Registry $doctrine, SecurityContextInterface $security) {
        
        $this->doctrine         = $doctrine;
        $this->manager          = $doctrine->getManager();
        $this->security         = $security;
    }
    
    public function getAvatar($idUser){
        
        $avatar = $this->manager
                       ->getRepository('MindMediaBundle:Avatar')
                       ->findOneBy(array('idUser'=>$idUser));
        
        return $avatar;
    }
    
    public function supprimerAvatar($idUser){
     
        $avatar = $this->manager
                       ->getRepository('MindMediaBundle:Avatar')
                       ->findOneBy(array('idUser'=>$idUser));
        if(!empty($avatar)){
            if($avatar->getPath() == "../web/img/avatar-femme.jpeg" or $avatar->getPath() == "../web/img/avatar-homme.jpeg" ){
                
            }else{
                $this->manager->remove($avatar);
{'fraction_non_alphanumeric': 0.12761904761904763, 'fraction_numerical': 0.0, 'mean_word_length': 2.0428736964078795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6864769', 'n_tokens_mistral': 734, 'n_tokens_neox': 716, 'n_words': 123}