src/Admin/Model/DoctrineRestServiceModel.php
/**
     * Create a collection class for the resource
     *
     * @param string $resourceName
     * @return string The name of the newly created collection class
     */
Create a collection class for the resource
@param string $resourceName
@return string The name of the newly created collection class
Create a collection class for the resource @param string $resourceName @return string The name of the newly created collection class
public function createCollectionClass($resourceName)
    {
        $module    = $this->module;
        $srcPath   = $this->getSourcePath($resourceName);
        $className = sprintf('%sCollection', $resourceName);
        $classPath = sprintf('%s/%s.php', $srcPath, $className);
        if (file_exists($classPath)) {
            throw new Exception\RuntimeException(sprintf(
                'The collection "%s" already exists',
                $className
            ));
        }
        $view = new ViewModel([
            'module'    => $module,
            'resource'  => $resourceName,
            'classname' => $className,
            'version'   => $this->moduleEntity->getLatestVersion(),
        ]);
        if (! $this->createClassFile($view, 'collection', $classPath)) {
            throw new Exception\RuntimeException(sprintf(
                'Unable to create entity "%s"; unable to write file',
                $className
            ));
        }
        $fullClassName = sprintf(
            '%s\\V%s\\Rest\\%s\\%s',
            $module,
            $this->moduleEntity->getLatestVersion(),
            $resourceName,
            $className
        );
        return $fullClassName;
    }
public function createCollectionClass ( $ resourceName ) { $ module = $ this -> module ; $ srcPath = $ this -> getSourcePath ( $ resourceName ) ; $ className = sprintf ( '%sCollection' , $ resourceName ) ; $ classPath = sprintf ( '%s/%s.php' , $ srcPath , $ className ) ; if ( file_exists ( $ classPath ) ) { throw new Exception \ RuntimeException ( sprintf ( 'The collection "%s" already exists' , $ className ) ) ; } $ view = new ViewModel ( [ 'module' => $ module , 'resource' => $ resourceName , 'classname' => $ className , 'version' => $ this -> moduleEntity -> getLatestVersion ( ) , ] ) ; if ( ! $ this -> createClassFile ( $ view , 'collection' , $ classPath ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Unable to create entity "%s"; unable to write file' , $ className ) ) ; } $ fullClassName = sprintf ( '%s\\V%s\\Rest\\%s\\%s' , $ module , $ this -> moduleEntity -> getLatestVersion ( ) , $ resourceName , $ className ) ; return $ fullClassName ; }
Create a collection class for the resource
 @param string $resourceName
 @return string The name of the newly created collection class
Create a collection class for the resource @param string $resourceName @return string The name of the newly created collection class