← All changes
|
backend/src/Hooks/Actions/OnBeforeDeletePost.php
+26
-26
1.5.5
→
1.5.5.1
View file →
| @@ -1,26 +1,26 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace FL\Assistant\Hooks\Actions; | |
| 4 | - | |
| 5 | -use FL\Assistant\Data\Repository\NotationsRepository; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * Class OnBeforeDeletePost | |
| 9 | - * @package FL\Assistant\Hooks\Actions | |
| 10 | - */ | |
| 11 | -class OnBeforeDeletePost { | |
| 12 | - | |
| 13 | - protected $notations; | |
| 14 | - | |
| 15 | - public function __construct( NotationsRepository $notations ) { | |
| 16 | - $this->notations = $notations; | |
| 17 | - } | |
| 18 | - | |
| 19 | - public function __invoke( $post_id ) { | |
| 20 | - $results = $this->notations->get_notations( 'post', $post_id ); | |
| 21 | - | |
| 22 | - foreach ( $results as $notation ) { | |
| 23 | - wp_delete_post( $notation['id'] ); | |
| 24 | - } | |
| 25 | - } | |
| 26 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace FL\Assistant\Hooks\Actions; | |
| 4 | + | |
| 5 | +use FL\Assistant\Data\Repository\NotationsRepository; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Class OnBeforeDeletePost | |
| 9 | + * @package FL\Assistant\Hooks\Actions | |
| 10 | + */ | |
| 11 | +class OnBeforeDeletePost { | |
| 12 | + | |
| 13 | + protected $notations; | |
| 14 | + | |
| 15 | + public function __construct( NotationsRepository $notations ) { | |
| 16 | + $this->notations = $notations; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public function __invoke( $post_id ) { | |
| 20 | + $results = $this->notations->get_notations( 'post', $post_id ); | |
| 21 | + | |
| 22 | + foreach ( $results as $notation ) { | |
| 23 | + wp_delete_post( $notation['id'] ); | |
| 24 | + } | |
| 25 | + } | |
| 26 | +} | |