record service naming change

This commit is contained in:
yuri
2018-12-26 12:54:58 +02:00
parent d40b7aef11
commit af9718951f
9 changed files with 47 additions and 60 deletions
+12 -12
View File
@@ -67,7 +67,7 @@ class Record extends Base
public function actionRead($params, $data, $request)
{
$id = $params['id'];
$entity = $this->getRecordService()->readEntity($id);
$entity = $this->getRecordService()->read($id);
if (empty($entity)) {
throw new NotFound();
@@ -95,7 +95,7 @@ class Record extends Base
$service = $this->getRecordService();
if ($entity = $service->createEntity($data)) {
if ($entity = $service->create($data)) {
return $entity->getValueMap();
}
@@ -116,7 +116,7 @@ class Record extends Base
$id = $params['id'];
if ($entity = $this->getRecordService()->updateEntity($id, $data)) {
if ($entity = $this->getRecordService()->update($id, $data)) {
return $entity->getValueMap();
}
@@ -140,12 +140,12 @@ class Record extends Base
throw new Forbidden("Max size should should not exceed " . $maxSizeLimit . ". Use offset and limit.");
}
$result = $this->getRecordService()->findEntities($params);
$result = $this->getRecordService()->find($params);
return array(
return [
'total' => $result['total'],
'list' => isset($result['collection']) ? $result['collection']->getValueMapList() : $result['list']
);
];
}
public function getActionListKanban($params, $data, $request)
@@ -195,7 +195,7 @@ class Record extends Base
throw new Forbidden("Max size should should not exceed " . $maxSizeLimit . ". Use offset and limit.");
}
$result = $this->getRecordService()->findLinkedEntities($id, $link, $params);
$result = $this->getRecordService()->findLinked($id, $link, $params);
return array(
'total' => $result['total'],
@@ -211,7 +211,7 @@ class Record extends Base
$id = $params['id'];
if ($this->getRecordService()->deleteEntity($id)) {
if ($this->getRecordService()->delete($id)) {
return true;
}
throw new Error();
@@ -262,9 +262,9 @@ class Record extends Base
$params['format'] = $data->format;
}
return array(
return [
'id' => $this->getRecordService()->export($params)
);
];
}
public function actionMassUpdate($params, $data, $request)
@@ -363,7 +363,7 @@ class Record extends Base
$result = false;
foreach ($foreignIdList as $foreignId) {
if ($this->getRecordService()->linkEntity($id, $link, $foreignId)) {
if ($this->getRecordService()->link($id, $link, $foreignId)) {
$result = true;
}
}
@@ -400,7 +400,7 @@ class Record extends Base
$result = false;
foreach ($foreignIdList as $foreignId) {
if ($this->getRecordService()->unlinkEntity($id, $link, $foreignId)) {
if ($this->getRecordService()->unlink($id, $link, $foreignId)) {
$result = $result || true;
}
}
+2 -2
View File
@@ -65,7 +65,7 @@ class Attachment extends Record
return $attachment;
}
public function createEntity($data)
public function create($data)
{
if (!empty($data->file)) {
$arr = explode(',', $data->file);
@@ -127,7 +127,7 @@ class Attachment extends Record
}
}
$entity = parent::createEntity($data);
$entity = parent::create($data);
if (!empty($data->file)) {
$entity->clear('contents');
+2 -2
View File
@@ -262,9 +262,9 @@ class Email extends Record
return $this->streamService;
}
public function createEntity($data)
public function create($data)
{
$entity = parent::createEntity($data);
$entity = parent::create($data);
if ($entity && $entity->get('status') == 'Sending') {
$this->send($entity);
+2 -2
View File
@@ -116,7 +116,7 @@ class EmailAccount extends Record
throw new Error();
}
public function createEntity($data)
public function create($data)
{
if (!$this->getUser()->isAdmin()) {
$count = $this->getEntityManager()->getRepository('EmailAccount')->where(array(
@@ -127,7 +127,7 @@ class EmailAccount extends Record
}
}
$entity = parent::createEntity($data);
$entity = parent::create($data);
if ($entity) {
if (!$this->getUser()->isAdmin()) {
$entity->set('assignedUserId', $this->getUser()->id);
@@ -41,24 +41,6 @@ class InboundEmail extends \Espo\Services\Record
const PORTION_LIMIT = 20;
public function createEntity($data)
{
$entity = parent::createEntity($data);
return $entity;
}
public function getEntity($id = null)
{
$entity = parent::getEntity($id);
return $entity;
}
public function updateEntity($id, $data)
{
$entity = parent::updateEntity($id, $data);
return $entity;
}
protected function init()
{
parent::init();
+6 -6
View File
@@ -48,7 +48,7 @@ class Note extends Record
return $entity;
}
public function createEntity($data)
public function create($data)
{
if (!empty($data->parentType) && !empty($data->parentId)) {
$entity = $this->getEntityManager()->getEntity($data->parentType, $data->parentId);
@@ -59,7 +59,7 @@ class Note extends Record
}
}
return parent::createEntity($data);
return parent::create($data);
}
protected function afterCreateEntity(Entity $entity, $data)
@@ -197,20 +197,20 @@ class Note extends Record
return true;
}
public function linkEntity($id, $link, $foreignId)
public function link($id, $link, $foreignId)
{
if ($link === 'teams' || $link === 'users') {
throw new Forbidden();
}
return parant::linkEntity($id, $link, $foreignId);
return parant::link($id, $link, $foreignId);
}
public function unlinkEntity($id, $link, $foreignId)
public function unlink($id, $link, $foreignId)
{
if ($link === 'teams' || $link === 'users') {
throw new Forbidden();
}
return parant::unlinkEntity($id, $link, $foreignId);
return parant::unlink($id, $link, $foreignId);
}
public function processNoteAclJob($data)
+13 -8
View File
@@ -261,7 +261,12 @@ class Record extends \Espo\Core\Services\Base
$this->getEntityManager()->saveEntity($historyRecord);
}
public function readEntity($id)
public function readEntity($id) //TODO Remove in 5.8
{
return $this->read($id);
}
public function read($id)
{
if (empty($id)) {
throw new Error();
@@ -787,7 +792,7 @@ class Record extends \Espo\Core\Services\Base
}
}
public function createEntity($data)
public function createEntity($data) //TODO Remove in 5.8
{
return $this->create($data);
}
@@ -845,7 +850,7 @@ class Record extends \Espo\Core\Services\Base
throw new Error();
}
public function updateEntity($id, $data)
public function updateEntity($id, $data) //TODO Remove in 5.8
{
return $this->update($id, $data);
}
@@ -944,7 +949,7 @@ class Record extends \Espo\Core\Services\Base
{
}
public function deleteEntity($id)
public function deleteEntity($id) //TODO Remove in 5.8
{
return $this->delete($id);
}
@@ -1285,7 +1290,7 @@ class Record extends \Espo\Core\Services\Base
];
}
public function linkEntity($id, $link, $foreignId)
public function linkEntity($id, $link, $foreignId) //TODO Remove in 5.8
{
return $this->link($id, $link, $foreignId);
}
@@ -1342,7 +1347,7 @@ class Record extends \Espo\Core\Services\Base
return true;
}
public function unlinkEntity($id, $link, $foreignId)
public function unlinkEntity($id, $link, $foreignId) //TODO Remove in 5.8
{
return $this->unlink($id, $link, $foreignId);
}
@@ -1403,7 +1408,7 @@ class Record extends \Espo\Core\Services\Base
return true;
}
public function linkEntityMass($id, $link, $where, $selectData = null)
public function linkEntityMass($id, $link, $where, $selectData = null) //TODO Remove in 5.8
{
return $this->linkMass($id, $link, $where, $selectData);
}
@@ -2238,7 +2243,7 @@ class Record extends \Espo\Core\Services\Base
{
}
protected function findLinkedEntitiesFollowers($id, $params)
protected function findLinkedFollowers($id, $params)
{
$maxSize = 0;
+4 -4
View File
@@ -174,21 +174,21 @@ class RecordTree extends Record
}
}
public function updateEntity($id, $data)
public function update($id, $data)
{
if (!empty($data->parentId) && $data->parentId == $id) {
throw new Forbidden();
}
return parent::updateEntity($id, $data);
return parent::update($id, $data);
}
public function linkEntity($id, $link, $foreignId)
public function link($id, $link, $foreignId)
{
if ($id == $foreignId ) {
throw new Forbidden();
}
return parent::linkEntity($id, $link, $foreignId);
return parent::link($id, $link, $foreignId);
}
public function getLastChildrenIdList($parentId = null)
+6 -6
View File
@@ -242,7 +242,7 @@ class User extends Record
}
}
public function createEntity($data)
public function create($data)
{
$newPassword = null;
if (property_exists($data, 'password')) {
@@ -250,7 +250,7 @@ class User extends Record
$data->password = $this->hashPassword($data->password);
}
$user = parent::createEntity($data);
$user = parent::create($data);
if (!is_null($newPassword) && !empty($data->sendAccessInfo)) {
if ($user->isActive()) {
@@ -263,7 +263,7 @@ class User extends Record
return $user;
}
public function updateEntity($id, $data)
public function update($id, $data)
{
if ($id == 'system') {
throw new Forbidden();
@@ -280,7 +280,7 @@ class User extends Record
unset($data->type);
}
$user = parent::updateEntity($id, $data);
$user = parent::update($id, $data);
if (!is_null($newPassword)) {
try {
@@ -576,7 +576,7 @@ class User extends Record
$this->getMailSender()->send($email);
}
public function deleteEntity($id)
public function delete($id)
{
if ($id == 'system') {
throw new Forbidden();
@@ -584,7 +584,7 @@ class User extends Record
if ($id == $this->getUser()->id) {
throw new Forbidden();
}
return parent::deleteEntity($id);
return parent::delete($id);
}
protected function checkEntityForMassRemove(Entity $entity)