| @@ 43-53 (lines=11) @@ | ||
| 40 | * @return Announcement |
|
| 41 | * @throws DoesNotExistException |
|
| 42 | */ |
|
| 43 | public function getById(int $id): Announcement { |
|
| 44 | $query = $this->db->getQueryBuilder(); |
|
| 45 | ||
| 46 | $query->select('*') |
|
| 47 | ->from($this->getTableName()) |
|
| 48 | ->where( |
|
| 49 | $query->expr()->eq('announcement_id', $query->createNamedParameter($id)) |
|
| 50 | ); |
|
| 51 | ||
| 52 | return $this->findEntity($query); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * Deletes an entity from the table |
|
| @@ 61-70 (lines=10) @@ | ||
| 58 | * @return Entity the deleted entity |
|
| 59 | * @since 14.0.0 |
|
| 60 | */ |
|
| 61 | public function delete(Entity $entity): Entity { |
|
| 62 | $qb = $this->db->getQueryBuilder(); |
|
| 63 | ||
| 64 | $qb->delete($this->tableName) |
|
| 65 | ->where( |
|
| 66 | $qb->expr()->eq('announcement_id', $qb->createNamedParameter($entity->getId())) |
|
| 67 | ); |
|
| 68 | $qb->execute(); |
|
| 69 | return $entity; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @param array $userGroups |
|