Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ This code belongs to the Group-Office developer tutorial:

https://groupoffice.readthedocs.io/en/latest/developer/index.html

Clone this as "tutorial" insde the go/modules folder:
Clone this as "tutorial" inside the `go/modules` folder:

```
cd go/modules
clone https://github.com/Intermesh/groupoffice-tutorial.git tutorial
````
git clone https://github.com/Intermesh/groupoffice-tutorial.git tutorial
24 changes: 16 additions & 8 deletions music/Module.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<?php

namespace go\modules\tutorial\music;

use go\core;
/**
* @copyright (c) 2019, Intermesh BV http://www.intermesh.nl

/**
* @copyright (c) 2019-2024, Intermesh BV https://www.intermesh.nl
* @author Merijn Schering <mschering@intermesh.nl>
* @author Joachim van de Haterd <jvdhaterd@intermesh.nl>
* @license http://www.gnu.org/licenses/agpl-3.0.html AGPLv3
*/
class Module extends core\Module {

public function getAuthor() {
class Module extends core\Module
{

public function getAuthor(): string
{
return "Intermesh BV <info@intermesh.nl>";
}


public function getStatus(): string
{
return self::STATUS_STABLE;
}
}
63 changes: 42 additions & 21 deletions music/controller/Artist.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,86 @@
<?php

namespace go\modules\tutorial\music\controller;

use Exception;
use go\core\jmap\EntityController;
use go\core\jmap\exception\InvalidArguments;
use go\core\util\ArrayObject;
use go\core\jmap\exception\StateMismatch;
use go\modules\tutorial\music\model;

/**
* The controller for the Artist entity
*
* @copyright (c) 2018, Intermesh BV http://www.intermesh.nl
* @copyright (c) 2019-2024, Intermesh BV https://www.intermesh.nl
* @author Merijn Schering <mschering@intermesh.nl>
* @author Joachim van de Haterd <jvdhaterd@intermesh.nl>
* @license http://www.gnu.org/licenses/agpl-3.0.html AGPLv3
*/
class Artist extends EntityController {

*/
final class Artist extends EntityController
{

/**
* The class name of the entity this controller is for.
*
* @return string
*
*/
protected function entityClass() {
protected function entityClass(): string
{
return model\Artist::class;
}
}

/**
* Handles the Artist entity's Artist/query command
*
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/query
*/
public function query($params) {
public function query(array $params): ArrayObject
{
return $this->defaultQuery($params);
}

/**
* Handles the Artist entity's Artist/get command
*
*
* @param array $params
* @return ArrayObject
* @throws Exception
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/get
*/
public function get($params) {
public function get(array $params): ArrayObject
{
return $this->defaultGet($params);
}

/**
* Handles the Artist entity's Artist/set command
*
*
* @see https://jmap.io/spec-core.html#/set
* @param array $params
* @return ArrayObject
* @throws StateMismatch
* @throws InvalidArguments
*/
public function set($params) {
public function set(array $params): ArrayObject
{
return $this->defaultSet($params);
}


/**
* Handles the Artist entity's Artist/changes command
*
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/changes
*/
public function changes($params) {
public function changes(array $params): ArrayObject
{
return $this->defaultChanges($params);
}
}
Expand Down
61 changes: 41 additions & 20 deletions music/controller/Genre.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,86 @@
<?php

namespace go\modules\tutorial\music\controller;

use go\core\jmap\Entity;
use go\core\jmap\EntityController;
use go\core\jmap\exception\InvalidArguments;
use go\core\util\ArrayObject;
use go\core\jmap\exception\StateMismatch;
use go\modules\tutorial\music\model;

/**
* The controller for the Genre entity
*
* @copyright (c) 2018, Intermesh BV http://www.intermesh.nl
* @copyright (c) 2019-2024, Intermesh BV https://www.intermesh.nl
* @author Merijn Schering <mschering@intermesh.nl>
* @author Joachim van de Haterd <jvdhaterd@intermesh.nl>
* @license http://www.gnu.org/licenses/agpl-3.0.html AGPLv3
*/
class Genre extends EntityController {

*/
final class Genre extends EntityController
{

/**
* The class name of the entity this controller is for.
*
* @return string
*/
protected function entityClass() {
protected function entityClass(): string
{
return model\Genre::class;
}
}

/**
* Handles the Genre entity's Genre/query command
*
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/query
*/
public function query($params) {
public function query(array $params): ArrayObject
{
return $this->defaultQuery($params);
}

/**
* Handles the Genre entity's Genre/get command
*
*
* @param array $params
* @return ArrayObject
* @throws \Exception
* @see https://jmap.io/spec-core.html#/get
*/
public function get($params) {
public function get(array $params): ArrayObject
{
return $this->defaultGet($params);
}

/**
* Handles the Genre entity's Genre/set command
*
*
* @see https://jmap.io/spec-core.html#/set
* @return ArrayObject
* @param array $params
* @return array
* @throws StateMismatch
* @throws InvalidArguments
*/
public function set($params) {
public function set(array $params): ArrayObject
{
return $this->defaultSet($params);
}


/**
* Handles the Genre entity's Genre/changes command
*
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/changes
*/
public function changes($params) {
public function changes(array $params): ArrayObject
{
return $this->defaultChanges($params);
}
}
Expand Down
77 changes: 77 additions & 0 deletions music/controller/Review.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php


namespace go\modules\tutorial\music\controller;

use Exception;
use go\core\jmap\EntityController;
use go\core\util\ArrayObject;
use go\modules\tutorial\music\model;
use go\core\jmap\exception\InvalidArguments;
use go\core\jmap\exception\StateMismatch;

final class Review extends EntityController
{

/**
* The class name of the entity this controller is for.
*
* @return model\Review::class
*/
protected function entityClass(): string
{
return model\Review::class;
}

/**
* Handles the Artist entity's Artist/query command
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/query
*/
public function query(array $params): ArrayObject
{
return $this->defaultQuery($params);
}

/**
* Handles the Artist entity's Artist/get command
*
* @param array $params
* @return ArrayObject
* @throws InvalidArguments|Exception
* @see https://jmap.io/spec-core.html#/get
*/
public function get(array $params): ArrayObject
{
return $this->defaultGet($params);
}

/**
* Handles the Artist entity's Artist/set command
*
* @see https://jmap.io/spec-core.html#/set
* @param array $params
* @return ArrayObject
* @throws StateMismatch
* @throws InvalidArguments
*/
public function set(array $params): ArrayObject
{
return $this->defaultSet($params);
}

/**
* Handles the Artist entity's Artist/changes command
* @param array $params
* @return ArrayObject
* @throws InvalidArguments
* @see https://jmap.io/spec-core.html#/changes
*/
public function changes(array $params): ArrayObject
{
return $this->defaultChanges($params);
}
}
Loading