1 | <?php |
||
22 | abstract class BusinessLayer { |
||
23 | |||
24 | protected $mapper; |
||
25 | |||
26 | public function __construct(BaseMapper $mapper){ |
||
27 | $this->mapper = $mapper; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Delete an entity |
||
32 | * @param int $id the id of the entity |
||
33 | * @param string $userId the name of the user for security reasons |
||
34 | * @throws DoesNotExistException if the entity does not exist |
||
35 | * @throws MultipleObjectsReturnedException if more than one entity exists |
||
36 | */ |
||
37 | public function delete($id, $userId){ |
||
41 | |||
42 | /** |
||
43 | * Deletes entities without specifying the owning user. |
||
44 | * This should never be called directly from the HTML API, but only in case |
||
45 | * we can actually trust the passed IDs (e.g. file deleted hook). |
||
46 | * @param array $ids the ids of the entities which should be deleted |
||
47 | */ |
||
48 | public function deleteById($ids){ |
||
51 | |||
52 | /** |
||
53 | * Finds an entity by id |
||
54 | * @param int $id the id of the entity |
||
55 | * @param string $userId the name of the user for security reasons |
||
56 | * @throws DoesNotExistException if the entity does not exist |
||
57 | * @throws MultipleObjectsReturnedException if more than one entity exists |
||
58 | * @return Entity the entity |
||
59 | */ |
||
60 | public function find($id, $userId){ |
||
69 | |||
70 | /** |
||
71 | * Finds all entities |
||
72 | * @param string $userId the name of the user for security reasons |
||
73 | * @return array the entities |
||
74 | */ |
||
75 | public function findAll($userId){ |
||
78 | |||
79 | /** |
||
80 | * Get the number of entities |
||
81 | * @param string $userId |
||
82 | */ |
||
83 | public function count($userId){ |
||
86 | } |
||
87 |