/**
  * Describes columns based on modeleted params
  */
 protected function describeColumns()
 {
     $modelerParams = $this->params->getParam('modeler');
     foreach ($modelerParams['elements'] as $element) {
         $fieldDescription = array('name' => $element['name'], 'type' => $element['type'], 'key' => null, 'reference' => $element['key'] == 'foreign' ? true : false, 'label' => $element['label'], 'validators' => $element['validators'], 'filters' => $element['filters']);
         if ($element['key'] == 'primary') {
             $this->definition[$element['table']]['primaryKey'] = $element['name'];
         }
         $this->definition[$element['table']]['fields'][$element['name']] = $fieldDescription;
     }
 }
 /**
  * returns descriptor instance
  *
  * @return \VisioCrudModeler\Descriptor\DataSourceDescriptorInterface
  */
 public function getDescriptor()
 {
     $adapter = $this->getServiceLocator()->get($this->params->getParam('adapterServiceKey'));
     $descriptors = $this->params->getParam('config')->get('descriptors');
     $descriptorAdapterName = $this->params->getParam('descriptor');
     if (!isset($descriptors[$descriptorAdapterName])) {
         throw new \VisioCrudModeler\Exception\DescriptorAdapterNotFound("Descriptor adapter name " . $descriptorAdapterName . " doesnt exists ");
     }
     $descriptor = $descriptors[$this->params->getParam('descriptor')]['adapter'];
     return $this->getDi()->get($descriptor, array('adapter' => $adapter, 'params' => $this->params));
 }
 /**
  * returns absolute path to module directory
  *
  * @return string
  */
 protected function moduleRoot()
 {
     $modulesDirectory = $this->params->getParam('modulesDirectory');
     $moduleName = $this->params->getParam('moduleName');
     return $modulesDirectory . DIRECTORY_SEPARATOR . $moduleName;
 }
 /**
  * proxy method for writing to console
  *
  * @param string $message
  */
 protected function console($message)
 {
     if ($this->params->getParam('console') instanceof \Zend\Console\Adapter\AdapterInterface) {
         $this->params->getParam('console')->writeLine($message);
     }
 }