Example #1
0
 /**      
  *   
  * UserId could be obj with an ->equals?
  *
  * @return Payload| boolean
  * 
  */
 function hasSameUserIdPayload(TodoEntity $todo, $userId)
 {
     // or an equals function if the Id can be an object
     if ((string) $userId !== (string) $todo->userId()) {
         return $this->payload->setStatus(Payload::NOT_AUTHORIZED)->setInput($userId)->setOutput($todo)->setMessages('the UserId & the UserId on the Todo are not the same');
     }
     return false;
 }
Example #2
0
 public function delete(TodoEntity $entity)
 {
     $affected = $this->pdo->perform('DELETE FROM todo WHERE todoId = :todoId', array('todoId' => $entity->todoId()));
     return (bool) $affected;
 }