| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | final class KnCommentArchivRepository extends EntityRepository implements KnCommentArchivRepositoryInterface |
||
| 16 | { |
||
| 17 | public function getByPost(int $postId): array |
||
| 18 | { |
||
| 19 | return $this->findBy( |
||
| 20 | ['post_id' => $postId], |
||
| 21 | ['id' => 'desc'], |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function getAmountByPost(KnPostArchivInterface $post): int |
||
| 26 | { |
||
| 27 | return $this->count(['post_id' => $post, 'deleted' => null]); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function prototype(): KnCommentArchivInterface |
||
| 31 | { |
||
| 32 | return new KnCommentArchiv(); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function save(KnCommentArchivInterface $comment): void |
||
| 36 | { |
||
| 37 | $em = $this->getEntityManager(); |
||
| 38 | |||
| 39 | $em->persist($comment); |
||
| 40 | $em->flush(); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function delete(KnCommentArchivInterface $comment): void |
||
| 49 | } |
||
| 50 | |||
| 51 | public function truncateByUser(int $userId): void |
||
| 62 | } |
||
| 63 | } |
||
| 64 |