Error while upgrading to 9.0 version

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Victor Santos
    Junior Member
    • Apr 2024
    • 4

    Error while upgrading to 9.0 version

    Olá boa tarde

    estou com o problema na hora de subir para a versão 9.0, aparece o seguinte erro Error: These classes should be fixed before upgrade. They extend classes that are removed in the next version.

    Espo\Custom\Hooks\CEmbarque\Ticket is sub-class of Espo\Core\Hooks\Base

    codigo:

    <?php
    namespace Espo\Custom\Hooks\CEmbarque;
    use Espo\ORM\Entity;
    class Ticket extends \Espo\Core\Hooks\Base
    {
    public function beforeSave(Entity $entity, array $options): void
    {
    //========================================= Extraindo dados da empresa =========================================//
    $empresaCrm = $entity->get('cNPJ'); // CNPJ da empresa
    if ($empresaCrm !== null) {
    $entityManager = $this->getEntityManager();
    $razaoSocialData = $entityManager->getRepository('Account')->where([
    'deleted' => 0,
    'sicCode' => $empresaCrm
    ])->findOne();
    if ($razaoSocialData !== null) {
    $entity->set('razaoSocial', $razaoSocialData->get('razaoSocial'));
    $entity->set('empresa', $razaoSocialData->get('name'));
    $entity->set('nContrato', $razaoSocialData->get('nContrato'));
    $entity->set('tipoEmpresa', $razaoSocialData->get('type'));
    }
    }
    }
    }
  • item
    Active Community Member
    • Mar 2017
    • 1512

    #2
    Ola,

    PHP Code:

    <?php
    class CEmbarque
    {    
        public static 
    int $order 41;

        public function 
    __construct(
            private 
    EntityManager $em,
            private 
    User $user
        
    ){}

        public function 
    beforeSave(Entity $entity, array $options): void
        
    {

            if (
    $entity->get('cNPJ')) {
               
    $razaoSocialData $this->em->getRDBRepository('Account' )
                       ->
    where([ 'sicCode' => $entity->get('cNPJ') ])
                       ->
    findOne()
            .....

           }
        }
    }
    remove : extends \Espo\Core\Hooks\Base
    add : __construct

    look my sample
    Last edited by item; 03-11-2025, 07:03 PM.
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    Working...