PHP Интерфейс Webiny\Component\Rest\Interfaces\CrudInterface

--------------------------------------------------------------------------------------------------------------- | Request type | Url | Mapping | Description | --------------------------------------------------------------------------------------------------------------- | GET | foo-class/ | FooClass::crudList | Retrieve all records in a collection. | | POST | foo-class/ | FooClass::crudCreate() | Create new record. | | DELETE | foo-class/{id} | FooClass::crudDelete($id) | Delete a record with the given id. | | GET | foo-class/{id} | FooClass::crudGet($id) | Retrieve a single record. | | PUT | foo-class/{id} | FooClass::crudReplace($id) | Replace a single record. | | PATCH | foo-class/{id} | FooClass::crudUpdate($id) | Update a single record. | ---------------------------------------------------------------------------------------------------------------
Показать файл Открыть проект

Открытые методы

Метод Описание
crudCreate ( ) : array | mixed Create new record.
crudDelete ( string $id ) : boolean Delete a record with the given id.
crudGet ( string $id ) : array | mixed Retrieve a single record.
crudList ( ) : array | mixed Retrieve all records in a collection.
crudReplace ( string $id ) : array | mixed Replace a single record.
crudUpdate ( string $id ) : array | mixed Update a single record.

Описание методов

crudCreate() публичный Метод

Create new record.
public crudCreate ( ) : array | mixed
Результат array | mixed Array containing the newly created record.

crudDelete() публичный Метод

Delete a record with the given id.
public crudDelete ( string $id ) : boolean
$id string Id of the record to be deleted.
Результат boolean True if delete was successful or false.

crudGet() публичный Метод

Retrieve a single record.
public crudGet ( string $id ) : array | mixed
$id string Id of the record that should be retrieved.
Результат array | mixed The requested record.

crudList() публичный Метод

Retrieve all records in a collection.
public crudList ( ) : array | mixed
Результат array | mixed A list of retrieved records. As an array with properties [records, totalCount, perPage, page].

crudReplace() публичный Метод

Note that the difference between crudUpdate and crudReplace is that in crudReplace, all current record attributes should be removed and the new attributes should be added, while in crudUpdate the attributes would only be added or deleted. In crudUpdate, if the record doesn't exist, it can be created.
См. также: http://tools.ietf.org/html/rfc5789
public crudReplace ( string $id ) : array | mixed
$id string Id of the record that should be replaced.
Результат array | mixed The replaced record.

crudUpdate() публичный Метод

Note that the difference between crudUpdate and crudReplace is that in crudReplace, all current record attributes should be removed and the new attributes should be added, while in crudUpdate the attributes would only be added or deleted. In crudUpdate, if the record doesn't exist, it can be created.
См. также: http://tools.ietf.org/html/rfc5789
public crudUpdate ( string $id ) : array | mixed
$id string Id of the record that should be replaced.
Результат array | mixed The updated, or created, record.