__construct() public method

public __construct ( string $name = null, string $namespaceName = null, array | string $flags = null, string $extends = null, array $interfaces = [], array $properties = [], array $methods = [], Zend\Code\Generator\DocBlockGenerator $docBlock = null )
$name string
$namespaceName string
$flags array | string
$extends string
$interfaces array
$properties array
$methods array
$docBlock Zend\Code\Generator\DocBlockGenerator
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $namespaceName
  * @param string $tableName
  * @param array  $loadedTable
  * @param array  $config
  */
 public function __construct($className, $moduleName, $namespaceName, $tableName, array $loadedTable = [], array $config = [])
 {
     // set config data
     $this->config = $config;
     $this->loadedTable = $loadedTable;
     $this->foreignKeys = [];
     /** @var ConstraintObject $foreignKey */
     foreach ($this->loadedTable['foreignKeys'] as $foreignKey) {
         foreach ($foreignKey->getColumns() as $column) {
             $this->foreignKeys[$column] = $foreignKey;
         }
     }
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $namespaceName);
     // add namespaces for foreign key tables
     foreach ($this->foreignKeys as $foreignKey) {
         $this->addUse($moduleName . '\\' . $this->config['namespaceStorage'] . '\\' . StaticFilter::execute($foreignKey->getReferencedTableName(), 'Word\\UnderscoreToCamelCase') . 'Storage');
     }
     // add used namespaces and extended classes
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorAwareInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->setImplementedInterfaces(['FactoryInterface']);
     // add methods
     $this->addCreateServiceMethod($className, $moduleName);
     $this->addClassDocBlock($className);
 }
Ejemplo n.º 2
0
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $entityModule
  * @param string $entityClass
  * @param array  $loadedTables
  * @param array  $config
  */
 public function __construct($className, $moduleName, $entityModule, $entityClass, array $loadedTables = [], array $config = [])
 {
     // set config data
     $this->config = $config;
     $tableName = $this->filterCamelCaseToUnderscore(str_replace('Entity', '', $entityClass));
     $loadedTable = $loadedTables[$tableName];
     $this->foreignKeys = [];
     /** @var ConstraintObject $foreignKey */
     foreach ($loadedTable['foreignKeys'] as $foreignKey) {
         foreach ($foreignKey->getColumns() as $column) {
             $this->foreignKeys[$column] = $foreignKey;
         }
     }
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $this->config['namespaceForm']);
     // add namespace for hydrator
     $this->addUse($entityModule . '\\' . $this->config['namespaceHydrator'] . '\\' . $this->filterUnderscoreToCamelCase($tableName) . 'Hydrator');
     // add namespace for input filter
     $this->addUse($entityModule . '\\' . $this->config['namespaceInputFilter'] . '\\' . $this->filterUnderscoreToCamelCase($tableName) . 'InputFilter');
     // add namespaces for foreign key tables
     foreach ($this->foreignKeys as $foreignKey) {
         $this->addUse($entityModule . '\\' . $this->config['namespaceStorage'] . '\\' . $this->filterUnderscoreToCamelCase($foreignKey->getReferencedTableName()) . 'Storage');
     }
     // add used namespaces and extended classes
     $this->addUse('Zend\\InputFilter\\InputFilterPluginManager');
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorAwareInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->addUse('Zend\\Hydrator\\HydratorPluginManager');
     $this->setImplementedInterfaces(['FactoryInterface']);
     // add methods
     $this->addCreateServiceMethod($className, $moduleName, $entityModule, $entityClass);
     $this->addClassDocBlock($className);
 }
 /**
  * @param string $controllerName
  * @param string $moduleName
  * @param string $entityModule
  * @param string $entityClass
  * @param array  $config
  */
 public function __construct($controllerName, $moduleName, $entityModule, $entityClass, array $config = [])
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct($controllerName . 'Factory', $moduleName . '\\' . $this->config['namespaceController']);
     // prepare repository params
     $repositoryClass = str_replace('Entity', '', $entityClass) . 'Repository';
     $repositoryNamespace = $entityModule . '\\' . $this->config['namespaceRepository'] . '\\' . $repositoryClass;
     // prepare form params
     if (in_array($controllerName, ['CreateController', 'UpdateController'])) {
         $formClass = str_replace('Entity', '', $entityClass) . 'DataForm';
         $formNamespace = $moduleName . '\\' . $this->config['namespaceForm'] . '\\' . $formClass;
         $this->addUse($formNamespace);
     } elseif (in_array($controllerName, ['DeleteController'])) {
         $formClass = str_replace('Entity', '', $entityClass) . 'DeleteForm';
         $formNamespace = $moduleName . '\\' . $this->config['namespaceForm'] . '\\' . $formClass;
         $this->addUse($formNamespace);
     }
     // add used namespaces and extended classes
     $this->addUse($repositoryNamespace);
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorAwareInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->setImplementedInterfaces(['FactoryInterface']);
     // add methods
     $this->addCreateServiceMethod($controllerName, $moduleName, $entityModule, $entityClass);
     $this->addClassDocBlock($controllerName);
 }
Ejemplo n.º 4
0
 /**
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 5
0
 /**
  * @param array $config
  * @param array $tableData
  */
 public function __construct(array $config = [], array $tableData = [])
 {
     // set config data
     $this->config = $config;
     $this->tableData = $tableData;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 6
0
 /**
  * @param array  $config
  * @param string $baseHydrator
  */
 public function __construct(array $config = [], $baseHydrator = 'ClassMethods')
 {
     // set config data and base hydrator
     $this->config = $config;
     $this->baseHydrator = $baseHydrator;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 7
0
 /**
  * @param array       $config
  * @param TableObject $tableObject
  */
 public function __construct(array $config = array(), TableObject $tableObject)
 {
     // set config data
     $this->config = $config;
     $this->tableObject = $tableObject;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 8
0
 /**
  * @param array  $config
  * @param string $tableName
  * @param array  $tableObjects
  */
 public function __construct(array $config = array(), $tableName, array $tableObjects = array())
 {
     // set config data
     $this->config = $config;
     $this->tableName = $tableName;
     $this->tableObjects = $tableObjects;
     // call parent constructor
     parent::__construct();
 }
 /**
  * @param array  $config
  * @param string $tableName
  * @param array  $loadedTables
  */
 public function __construct(array $config = [], $tableName, array $loadedTables = [])
 {
     // set config data
     $this->config = $config;
     $this->tableName = $tableName;
     $this->loadedTables = $loadedTables;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 10
0
 /**
  * @param Parameters $params
  * @param string     $refTableName
  */
 public function __construct(Parameters $params, $refTableName)
 {
     // set config data
     $this->config = $params->config;
     $this->refTableName = $refTableName;
     $this->tableObjects = $params->currentTableObjects;
     $this->entityClass = ucfirst($refTableName) . 'Entity';
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 11
0
 /**
  * @param Parameters $params
  * @param string     $refTableName
  */
 public function __construct(Parameters $params, $refTableName)
 {
     // set config data
     $this->config = $params->config;
     $this->refTableName = $refTableName;
     $this->loadedTables = $params->loadedTables;
     $this->entityClass = $params->tableConfig[$refTableName]['entityClass'];
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 12
0
 /**
  * @param null|string $paramModule
  * @param null|string $entityModule
  * @param array       $loadedTables
  * @param array       $config
  */
 public function __construct($paramModule, $entityModule, $entityClass, array $loadedTables = [], array $config = [])
 {
     // set config data
     $this->paramModule = $paramModule;
     $this->entityModule = $entityModule;
     $this->entityClass = $entityClass;
     $this->loadedTables = $loadedTables;
     $this->config = $config;
     // call parent constructor
     parent::__construct();
 }
 /**
  * @param null|string $controllerName
  * @param null|string $paramModule
  * @param null|string $entityModule
  * @param null|string $entityClass
  * @param array       $config
  */
 public function __construct($controllerName, $paramModule, $entityModule, $entityClass, array $config = [])
 {
     // set config data
     $this->controllerName = $controllerName;
     $this->paramModule = $paramModule;
     $this->entityModule = $entityModule;
     $this->entityClass = $entityClass;
     $this->config = $config;
     // call parent constructor
     parent::__construct();
 }
Ejemplo n.º 14
0
 /**
  * @param null|string $moduleName
  * @param null|string $moduleRootConstant
  * @param array       $config
  */
 public function __construct($moduleName, $moduleRootConstant, array $config = [])
 {
     // set config data
     $this->config = $config;
     $this->moduleRootConstant = $moduleRootConstant;
     // call parent constructor
     parent::__construct('Module', $moduleName);
     // add methods
     $this->addInitMethod();
     $this->addGetConfigMethod();
     $this->addGetAutoloaderConfigMethod();
     $this->addClassDocBlock($moduleName);
 }
Ejemplo n.º 15
0
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $namespaceName
  * @param string $managerName
  * @param array  $config
  */
 public function __construct($className, $moduleName, $namespaceName, $managerName, array $config = array())
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $namespaceName);
     // add used namespaces and extended classes
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorAwareInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->setImplementedInterfaces(array('FactoryInterface'));
     // add methods
     $this->addCreateServiceMethod($className, $managerName);
     $this->addClassDocBlock($className);
 }
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $namespaceName
  * @param string $tableName
  * @param array  $config
  */
 public function __construct($className, $moduleName, $namespaceName, $tableName, array $config = [])
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $namespaceName);
     // add used namespaces and extended classes
     $this->addUse($moduleName . '\\' . $this->config['namespaceTableGateway'] . '\\' . ucfirst($tableName) . 'TableGateway');
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->setImplementedInterfaces(['FactoryInterface']);
     // add methods
     $this->addCreateServiceMethod($className, $moduleName, $tableName);
     $this->addClassDocBlock($className);
 }
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $tableName
  * @param array  $config
  * @param array  $loadedTables
  */
 public function __construct($className, $moduleName, $tableName, array $config = [], array $loadedTables = [])
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $this->config['namespaceTableGateway']);
     // add used namespaces and extended classes
     $this->addUse($moduleName . '\\' . $this->config['namespaceEntity'] . '\\' . StaticFilter::execute($tableName, 'Word\\UnderscoreToCamelCase') . 'Entity');
     $this->addUse($moduleName . '\\' . $this->config['namespaceHydrator'] . '\\' . StaticFilter::execute($tableName, 'Word\\UnderscoreToCamelCase') . 'Hydrator');
     $this->addUse('Zend\\Db\\Adapter\\AdapterInterface');
     $this->addUse('Zend\\Db\\ResultSet\\HydratingResultSet');
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->addUse('Zend\\Hydrator\\HydratorPluginManager');
     $this->setImplementedInterfaces(['FactoryInterface']);
     // add methods
     $this->addCreateServiceMethod($className, $moduleName, $tableName, $loadedTables[$tableName]);
     $this->addClassDocBlock($className);
 }
Ejemplo n.º 18
0
 /**
  * @param string $className
  * @param string $moduleName
  * @param string $namespaceName
  * @param string $tableName
  * @param array  $config
  */
 public function __construct($className, $moduleName, $namespaceName, $tableName, array $config = array())
 {
     // set config data
     $this->config = $config;
     // call parent constructor
     parent::__construct($className . 'Factory', $moduleName . '\\' . $namespaceName);
     // add used namespaces and extended classes
     $this->addUse($moduleName . '\\' . $this->config['namespaceEntity'] . '\\' . ucfirst($tableName) . 'Entity');
     $this->addUse($moduleName . '\\' . $this->config['namespaceHydrator'] . '\\' . ucfirst($tableName) . 'Hydrator');
     $this->addUse('Zend\\Db\\Adapter\\AdapterInterface');
     $this->addUse('Zend\\Db\\ResultSet\\HydratingResultSet');
     $this->addUse('Zend\\ServiceManager\\FactoryInterface');
     $this->addUse('Zend\\ServiceManager\\ServiceLocatorInterface');
     $this->addUse('Zend\\Stdlib\\Hydrator\\HydratorPluginManager');
     $this->setImplementedInterfaces(array('FactoryInterface'));
     // add methods
     $this->addCreateServiceMethod($className, $moduleName, $tableName);
     $this->addClassDocBlock($className);
 }