src/Controller/BaseController.php
/**
     * Delete picture in the folter if already a picture
     *
     * @param mixed $object
     * @return void
     */
Delete picture in the folter if already a picture
@param mixed $object
@return void
Delete picture in the folter if already a picture @param mixed $object @return void
public function checkPictureExist($object): void
    {
        switch (get_class($object)) {
            case User::class:
                if ($object->getAvatar() != null) {
                    $name = $object->getAvatar();
                    unlink($this->getParameter(self::KEY_DIRECTORY_AVATAR) . '/' . $name);
                }
                break;
            default:
        }
    }
public function checkPictureExist ( $ object ) : void { switch ( get_class ( $ object ) ) { case User :: class : if ( $ object -> getAvatar ( ) != null ) { $ name = $ object -> getAvatar ( ) ; unlink ( $ this -> getParameter ( self :: KEY_DIRECTORY_AVATAR ) . '/' . $ name ) ; } break ; default : } }
Delete picture in the folter if already a picture
 @param mixed $object
 @return void
Delete picture in the folter if already a picture @param mixed $object @return void
//We get the fullname of the document //Delete document in the folder