src/Model/Behavior/ProfferBehavior.php
protected function createPath(EntityInterface $entity, $field, array $settings, ProfferPathInterface $path = null)
    {
        if (!empty($settings['pathClass'])) {
            $path = new $settings['pathClass']($this->_table, $entity, $field, $settings);
            if (!$path instanceof ProfferPathInterface) {
                throw new InvalidClassException("Class {$settings['pathClass']} does not implement the ProfferPathInterface.");
            }
        } elseif (!isset($path)) {
            $path = new ProfferPath($this->_table, $entity, $field, $settings);
        }

        $event = new Event('Proffer.afterPath', $entity, ['path' => $path]);
        $this->_table->getEventManager()->dispatch($event);
        if (!empty($event->result)) {
            $path = $event->result;
        }

        $path->createPathFolder();

        return $path;
    }
protected function createPath(EntityInterface $entity, $field, array $settings, ProfferPathInterface $path = null)
    {
        if (!empty($settings['pathClass'])) {
            $path = new $settings['pathClass']($this->_table, $entity, $field, $settings);
            if (!$path instanceof ProfferPathInterface) {
                throw new InvalidClassException("Class {$settings['pathClass']} does not implement the ProfferPathInterface.");
            }
        } elseif (!isset($path)) {
            $path = new ProfferPath($this->_table, $entity, $field, $settings);
        }

        $event = new Event('Proffer.afterPath', $entity, ['path' => $path]);
        $this->_table->getEventManager()->dispatch($event);
        if (!empty($event->result)) {
            $path = $event->result;
        }

        $path->createPathFolder();

        return $path;
    }
protected function createPath ( EntityInterface $ entity , $ field , array $ settings , ProfferPathInterface $ path = null ) { if ( ! empty ( $ settings [ 'pathClass' ] ) ) { $ path = new $ settings [ 'pathClass' ] ( $ this -> _table , $ entity , $ field , $ settings ) ; if ( ! $ path instanceof ProfferPathInterface ) { throw new InvalidClassException ( "Class {$settings['pathClass']} does not implement the ProfferPathInterface." ) ; } } elseif ( ! isset ( $ path ) ) { $ path = new ProfferPath ( $ this -> _table , $ entity , $ field , $ settings ) ; } $ event = new Event ( 'Proffer.afterPath' , $ entity , [ 'path' => $ path ] ) ; $ this -> _table -> getEventManager ( ) -> dispatch ( $ event ) ; if ( ! empty ( $ event -> result ) ) { $ path = $ event -> result ; } $ path -> createPathFolder ( ) ; return $ path ; }
Load a path class instance and create the path for the uploads to be moved into

@param \Cake\Datasource\EntityInterface $entity Instance of the entity
@param string $field The upload field name
@param array $settings Array of upload settings for the field
@param \Proffer\Lib\ProfferPathInterface|null $path Inject an instance of ProfferPath

@throws \App\Exception\InvalidClassException If the custom class doesn't implement the interface

@return \Proffer\Lib\ProfferPathInterface
Load a path class instance and create the path for the uploads to be moved into