/** * Get the template data from a stream object. * * @param Module $module * @param StreamInterface $stream * @param AssignmentModel $assignment * @param array $fieldConfig * * @return array */ protected function getTemplateData(Module $module, StreamInterface $stream, AssignmentModel $assignment, $fieldConfig) { $entityName = (new EntityNameParser())->parse($stream); $moduleName = (new ModuleNameParser())->parse($module); $fieldSlug = (new AssignmentSlugParser())->parse($assignment); $fieldLabel = (new AssignmentLabelParser())->parse($assignment); $namespace = (new NamespaceParser())->parse($stream); /* wheather we use a grouping folder for all streams with the same namespace */ $namespaceFolder = _getNamespaceFolder($module, $namespace); return ['namespace' => $namespace, 'namespace_folder' => $namespaceFolder, 'vendor_name' => (new VendorNameParser())->parse($module), 'module_name' => $moduleName, 'entity_name' => $entityName, 'field_slug' => $fieldSlug, 'field_label' => $fieldLabel, 'relation_name' => camel_case($fieldSlug), 'null_relationship_entry' => _nullRelationshipEntry($module), 'column_template' => $fieldConfig['column_template']]; }
/** * Get the template data from a stream object. * * @param Module $module * @param StreamInterface $stream * * @return array */ protected function getTemplateData(Module $module, StreamInterface $stream) { $entityName = (new EntityNameParser())->parse($stream); $entityLabel = (new EntityLabelParser())->parse($stream); $moduleName = (new ModuleNameParser())->parse($module); $namespace = (new NamespaceParser())->parse($stream); $vendorName = (new VendorNameParser())->parse($module); /* check if we are using a grouping folder for all generated entities with the same namespace */ $namespace_folder = _getNamespaceFolder($module, $namespace); return ['docblock' => _getDocblock($module), 'namespace' => $namespace, 'seeder_data' => (new SeedersParser())->parse($module, $stream), 'namespace_folder' => $namespace_folder, 'vendor_name' => $vendorName, 'vendor_name_lower' => strtolower($vendorName), 'module_name' => $moduleName, 'module_name_lower' => strtolower($moduleName), 'stream_slug' => $stream->getSlug(), 'studly_case_stream_slug' => studly_case($stream->getSlug()), 'entity_label' => $entityLabel, 'entity_label_plural' => str_plural($entityLabel), 'entity_name' => $entityName, 'entity_name_plural' => str_plural($entityName), 'entity_name_lower' => strtolower($entityName), 'entity_name_lower_plural' => strtolower(str_plural($entityName)), 'extends_repository' => _extendsRepository($module), 'extends_repository_use' => _extendsRepositoryUse($module)]; }