Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[WIP] Add additional structure and comments to create more of a skeleton #14

Closed
wants to merge 1 commit into from

5 participants

@arse
  • Added data directory with suggestion of filenames
  • Added public directory with readme.md and js and css sub-dirs.
  • Added few more comments to ease the burden of the initially frightening config file
  • Added description to module class file
tr added data, public directories with readme.md and added few more comm…
…ents to ease the burden of the initially frightening config file, and description to module class file
4d21c93
@weierophinney weierophinney commented on the diff
Module.php
((11 lines not shown))
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
+
+/*
+ public function init($moduleManager)
+ {
+ // Any module dependencies your module relies on could be placed here
+ // load will throw an exception if the module can't be loaded
+ // $moduleManager->load('someModule');
+
+ }
+*/
@weierophinney Owner

I wouldn't add this. onBootstrap is more likely to be utilized at this point, and we don't want to encourage using init() as it will get triggered for every page.

@EvanDotPro Collaborator

@weierophinney, Well, for the specific feature that he has commented out here, init() would be the proper place to do it (bootstrap is too late for this to work properly). That said, we really just need to document it in the docs, where we can appropriately add more warnings about the potential performance pitfalls of doing stuff in init().

@arse
arse added a note

note to self, this should be changed to $mm->loadModule

Also look at your indentation @ line 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney commented on the diff
data/README.md
@@ -0,0 +1,22 @@
+
+Data Directory
+=================
+
+Sql files for your module can be placed here with a filename: "name.dbtype.sql"
@weierophinney Owner

More than just sql files -- you might want to put default keys, sqlite databases, and more in this directory -- it's data the module may need to consume, but not necessarily restricted to databases.

@arse
arse added a note

also need to add when using sqlite, directory needs to be writable so journal files can be created by sqlite else a cryptic message is created.

@EvanDotPro Collaborator

I'd argue that we should not necessarily promote putting anything in here that would be written to at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w
Collaborator

Closed due inactivity

@Maks3w Maks3w closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 3, 2012
  1. added data, public directories with readme.md and added few more comm…

    tr authored
    …ents to ease the burden of the initially frightening config file, and description to module class file
This page is out of date. Refresh to see the latest.
View
19 Module.php
@@ -12,6 +12,11 @@
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\Mvc\ModuleRouteListener;
+/**
+ * Short Description of module
+ *
+ * Long Description of module
+ */
class Module implements AutoloaderProviderInterface
{
public function getAutoloaderConfig()
@@ -33,12 +38,22 @@ public function getConfig()
return include __DIR__ . '/config/module.config.php';
}
- public function onBootstrap($e)
+ public function onBootstrap($event)
{
// You may not need to do this if you're doing it elsewhere in your
// application
- $eventManager = $e->getApplication()->getEventManager();
+ $eventManager = $event->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
+
+/*
+ public function init($moduleManager)
+ {
+ // Any module dependencies your module relies on could be placed here
+ // load will throw an exception if the module can't be loaded
+ // $moduleManager->load('someModule');
+
+ }
+*/
@weierophinney Owner

I wouldn't add this. onBootstrap is more likely to be utilized at this point, and we don't want to encourage using init() as it will get triggered for every page.

@EvanDotPro Collaborator

@weierophinney, Well, for the specific feature that he has commented out here, init() would be the proper place to do it (bootstrap is too late for this to work properly). That said, we really just need to document it in the docs, where we can appropriately add more warnings about the potential performance pitfalls of doing stuff in init().

@arse
arse added a note

note to self, this should be changed to $mm->loadModule

Also look at your indentation @ line 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
View
2  README.md
@@ -1 +1 @@
-Sample, skeleton module for use with the ZF2 MVC layer.
+Sample skeleton module for use with the ZF2 MVC layer.
View
8 config/module.config.php
@@ -1,10 +1,17 @@
<?php
return array(
+ // as the configuration is one large array, place your module specific
+ // config inside a key unique to your module.
+ 'zend_skeleton_module' => array(
+
+ ),
+ // controller config
'controllers' => array(
'invokables' => array(
'skeleton' => 'ZendSkeletonModule\Controller\SkeletonController',
),
),
+ // define any routes the module needs
'router' => array(
'routes' => array(
'module-name-here' => array(
@@ -42,6 +49,7 @@
),
),
),
+ // define options for the view manager
'view_manager' => array(
'template_path_stack' => array(
'ZendSkeletonModule' => __DIR__ . '/../view',
View
22 data/README.md
@@ -0,0 +1,22 @@
+
+Data Directory
+=================
+
+Sql files for your module can be placed here with a filename: "name.dbtype.sql"
@weierophinney Owner

More than just sql files -- you might want to put default keys, sqlite databases, and more in this directory -- it's data the module may need to consume, but not necessarily restricted to databases.

@arse
arse added a note

also need to add when using sqlite, directory needs to be writable so journal files can be created by sqlite else a cryptic message is created.

@EvanDotPro Collaborator

I'd argue that we should not necessarily promote putting anything in here that would be written to at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+name: The name can be anything. It's suggested you use the name 'schema' for sql files
+which create compulsory sql, and any other name for optional sql code.
+
+dbtype: This denotes what engine the sql code is for:
+ sqlite
+ mysql
+ postgresql
+ sqlserver
+ sql92
+
+Examples
+---------
+
+ * schema.mysql.sql compulsory sql code that the modules needs to run
+
+ * featurefoo.sqlite.sql optional sql code for sqlite which the module can use to add extra feature/s
View
6 public/README.md
@@ -0,0 +1,6 @@
+
+Public
+========
+
+This directory is for the benefit of the users of your module. Place files you need for public web access
+inside here with the structure you need. Users can either symlink / copy files as necessary.
View
5 public/css/README.md
@@ -0,0 +1,5 @@
+
+CSS Files
+==========
+
+Place CSS files here
View
5 public/js/README.md
@@ -0,0 +1,5 @@
+
+js
+====
+
+Place javascript files in here
Something went wrong with that request. Please try again.