src/Controller/Component/ExtensionComponent.php
public function getEntity($plugin)
    {
        $plugin = Inflector::camelize($plugin);
        $slug   = Str::low($plugin);
        $entity = $this->_controller->Extensions->findBySlug($slug)->first();
        if ($entity === null) {
            $entity = $this->_controller->Extensions->newEntity([
                'params' => [],
                'slug'   => $slug,
                'name'   => $plugin
            ]);

            $config = Plugin::getData($plugin, 'meta');
            $entity
                ->set('core', $config->get('core', false))
                ->set('name', $config->get('name', $plugin));
        }

        return $entity;
    }
public function getEntity($plugin)
    {
        $plugin = Inflector::camelize($plugin);
        $slug   = Str::low($plugin);
        $entity = $this->_controller->Extensions->findBySlug($slug)->first();
        if ($entity === null) {
            $entity = $this->_controller->Extensions->newEntity([
                'params' => [],
                'slug'   => $slug,
                'name'   => $plugin
            ]);

            $config = Plugin::getData($plugin, 'meta');
            $entity
                ->set('core', $config->get('core', false))
                ->set('name', $config->get('name', $plugin));
        }

        return $entity;
    }
public function getEntity ( $ plugin ) { $ plugin = Inflector :: camelize ( $ plugin ) ; $ slug = Str :: low ( $ plugin ) ; $ entity = $ this -> _controller -> Extensions -> findBySlug ( $ slug ) -> first ( ) ; if ( $ entity === null ) { $ entity = $ this -> _controller -> Extensions -> newEntity ( [ 'params' => [ ] , 'slug' => $ slug , 'name' => $ plugin ] ) ; $ config = Plugin :: getData ( $ plugin , 'meta' ) ; $ entity -> set ( 'core' , $ config -> get ( 'core' , false ) ) -> set ( 'name' , $ config -> get ( 'name' , $ plugin ) ) ; } return $ entity ; }
Get current plugin entity.

@param   string $plugin
@return  \Cake\Datasource\EntityInterface|\Cake\ORM\Entity|mixed
Get current plugin entity .