Overriding entity controller
Collapse
X
-
Leave a comment:
-
I think is better when class Account extends \Espo\Modules\Crm\Services\Account, because you lose the default functionalityLeave a comment:
-
Nice, thank you. The problem was my controller namespace
PHP Code:namespace Espo\Custom\Controllers; use Espo\Core\Controllers\Record as RecordUsage; class Account extends RecordUsage { public function postActionGetHashedLogin($request, $params) { return json_encode(crypt($params['userCode'], 'test')); } }
Leave a comment:
-
Overriding entity controller
Hello,
How could I make an override for entity controller? I made an override for "Account" entity and I want to make a custom AJAX call from that view.
I have this request:
this.ajaxPostRequest(this.scope + '/action/myFunction', {
UserCode: this.model.attributes.sicCode }).then(function (attributes)
{
console.log(attributes);
}.bind(this));
Now how could I override the "Account" controller? I created the override file here: custom/Espo/Custom/Controllers/Account.php
Function "myFunction" is of course inside it, but it still doesn't see it and says that there is no myFunction in "Account" controller.
The controller file is here:
PHP Code:<?php namespace Espo\Core\Controllers; class Account extends Base { public function myFunction() { die(true); } }
Last edited by The50; 12-19-2017, 03:45 PM.
Leave a comment: