Extending Orm/RDB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abanoub
    Junior Member
    • Sep 2016
    • 23

    Extending Orm/RDB

    what am trying to extend is

    PHP Code:
      \Espo\Core\ORM\Repositories\RDB 
    
    as follow:

    PHP Code:
    <?php  namespace Espo\Custom\ORM\Repositories;  
    class RDB extends \Espo\Core\ORM\Repositories\RDB {    
    public function handleSelectParams(&$params)     {         parent::handleSelectParams($params);         $this->handleMeasurementParams($params);     }      protected function handleMeasurementParams(&$params)     {         die(var_dump("here"));         $entityType = $this->entityType;          $metadata = $this->getMetadata();          if (!$metadata) {             return;         }          $defs = $metadata->get('entityDefs.' . $entityType);          foreach ($defs['fields'] as $field => $d) {             if (isset($d['type']) && $d['type'] == 'measurement') {                 if (!empty($d['notStorable'])) {                     continue;                 }                 if (empty($params['customJoin'])) {                     $params['customJoin'] = '';                 }                 $alias = Util::toUnderScore($field) . "_measurement_alias";                 $params['customJoin'] .= "                     LEFT JOIN measurement AS `{$alias}` ON {$alias}.id = ".Util::toUnderScore($entityType).".".Util::toUnderScore($field)."_measurement                 ";             }         }      } }
    but it's not reading my custom class , is there away to inject/hook it?
  • yuri
    Member
    • Mar 2014
    • 8485

    #2
    Only this will work

    \Espo\Custom\Repositories\CustomEntityName
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Abanoub
      Junior Member
      • Sep 2016
      • 23

      #3
      Originally posted by yurikuzn
      Only this will work

      \Espo\Custom\Repositories\CustomEntityName
      any plans for allowing it to be extended , because it's really needed , I can do it though , but it might get conflicted with your updates!

      Comment

      • yuri
        Member
        • Mar 2014
        • 8485

        #4
        Not possible technically.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • Abanoub
          Junior Member
          • Sep 2016
          • 23

          #5
          Originally posted by yurikuzn
          Not possible technically.
          it is possible by Injection/Hooks

          Comment

          Working...