1. Go to this page and download the library: Download mezon/crud-service-model library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mezon / crud-service-model example snippets
class EntityModel extends CrudServiceModel
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct('*', 'entity_table_name');
}
}
// Method fetches all new records since the $date
// For example $model->newRecordsSince($domainId, '2021-01-01');
newRecordsSince($domainId, string $date): array;
// Method calculates count of records fetched by filter
// For example $model->recordsCount(false, ['field1 = 1', 'field2 = 2']);
recordsCount($domainId = false, array $where = ['1=1']);
// Method returns data as is without any transformations
getSimpleRecords($domainId, int $from, int $limit, array $where, array $order = []): array;
// Method returns records wich are transformed by method getRecordsTransformer wuch
// you can override in your subclass
getRecords($domainId, int $from, int $limit, array $where = ['1=1'], array $order = []): array;
// Method returns the last $count records filtered by where
lastRecords($domainId, $count, $where): array;
// Method returns records by their ids
fetchRecordsByIds($domainId, string $ids): array;
// Method calculates count of records grouped by fieldName and filtered by where
recordsCountByField($domainId, string $fieldName, array $where): array;
// Method updates records with values record
updateBasicFields($domainId, array $record, array $where): array;
// Method inserts record record
insertBasicFields(array $record, $domainId = 0): array;
// Method deletes all records filtered by where
deleteFiltered($domainId, array $where): int;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.