Created
May 24, 2021 11:30
-
-
Save SilentKernel/0c92fc683f712b7d8a039e52068bf4ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
class BlogArticle | |
{ | |
// ... Les autres attribus de la classe | |
/** | |
* @ORM\Column(type="json") | |
*/ | |
private $oldSlugs = []; | |
// ... les getter et setter de la classe | |
/** | |
* @param string|null $title | |
*/ | |
public function setTitle(?string $title): void | |
{ | |
if ($this->slug !== null) { | |
// Ici on sauvegarde l'ancien slug avant un changement | |
$this->oldSlugs[] = $this->slug; | |
} | |
$this->title = $title; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment