Service Manager

The service manager provides methods for easy access to API resources data data. The manager tries to follow the same principle as a ObjectManager, from Doctrine, where you have a manager to the repositories. Instead of a repository we have a service.

Create an instance of the resource service

$listsService = $wunderlist->getService(WList::class);

Get all records for a resource

$lists = $wunderlist->getService(WList::class)->all();

Get a specific resource

$list = $wunderlist->find(WList::class, 777);

Get a specific resource for a user

$user = $wunderlist->getService(User::class)->current();
$lists = $wunderlist->forUser(WList::class, $user);

Get a specific resource for a list

$list = $wunderlist->find(WList::class, 777);
$tasks = $wunderlist->forList(Task::class, $list);

Get a specific resource for a task

$task = $wunderlist->find(Task::class, 777);
$subtasks = $wunderlist->forTask(Subtask::class, $task);

Create a resource

$list = new Wunderlist\Entity\WList();
$list->setTitle('Bad Movies');
$wunderlist->save($list);

Update a resource

$list = $wunderlist->find(WList::class, 777);
$list->setTitle('Good Bad Movies');
$wunderlist->save($list);

Delete a resource

$list = $wunderlist->find(WList::class, 777);
$wunderlist->delete($list);