Announcement

Collapse
No announcement yet.

Overriding entity controller

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tanya
    replied
    sorry, not Service, but Controller - \Espo\Modules\Crm\Controllers\Account

    Leave a comment:


  • The50
    replied
    Originally posted by tanya View Post
    I think is better when class Account extends \Espo\Modules\Crm\Services\Account, because you lose the default functionality
    I just tried it, but this way I get bad server response error when I get to the main "Account" page where the list of all the accounts is present.

    Leave a comment:


  • tanya
    replied
    I think is better when class Account extends \Espo\Modules\Crm\Services\Account, because you lose the default functionality

    Leave a comment:


  • The50
    replied
    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:


  • tanya
    replied
    http://forum.espocrm.com/forum/devel...mplate-in-html
    http://forum.espocrm.com/forum/developer-help/23755-how-to-call-a-custom-method-of-controller

    Leave a comment:


  • The50
    started a topic Overriding entity controller

    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);
        }
    }
    What am I doing wrong?
    Last edited by The50; 12-19-2017, 03:45 PM.
Working...
X