zend framework 2 out of the box modular system - zend-framework2

I want to make a modular CMS in Zend Framework 2 . Like News module , Gallery module and etc...
How to make independent module in zf2 ? My biggest challenge in this case is configuring other modules like Zfcadmin and BjyAuthorize modules.
How Can I set all configurations in my own module ? Is it possible ?

You can config other modules in your module. For example you can add child route of ZfcAdmin in your news module . There is no obligation to configure each module in its module.config.php file. Remember modules are just namespaces

You should definitely have a look at ensemble if you want to develop your own CMS. Ensemble is built on top of ZfcAdmin so you can hook into both if you want to.
Disclaimer: I am the author of both Ensemble and ZfcAdmin
With regard to the configuration of ZfcAdmin, you should definitely start with the documentation. It's provided in the repository of ZfcAdmin. There is also a single page document about BjyAuthorize how to configure the module.
If you are not familiar with ZF2 and modules of ZF2 in general, I suggest to follow the user guide first.

Related

Why does Abp.AspNetCore.OData require services.AddOData()?

In the aspnetboilerplate documentation is a tutorial on how to use the Abp.AspNetCore.OData module. I study this module as a reference for creating my own GraphQL module. However, I am somewhat confused on why after declaring a dependency on the OData module it is still required to explicitly configure the services with
services.AddOData();
inside the Startup class from the actual Asp.NET Core project?
Sure, it is required because the Abp.AspNetCore.OData module does not do it. But isn't a big part of the idea of ABP's module system to automatically register all dependencies when declaring a dependency on a specific module with the DependsOn attribute? This way the encapsulation in a ABP module seems somewhat useless.
services.AddOData() is called in Startup.cs; it would require hacking around to be called in an ABP module.
Often, services.AddXxx() calls depend on the earlier adding of other services.
Not all of those services are going to be ABP modules so it's not possible to make sure that they are called in the order that the service needs and the developer wants.

Can we create module in prestashop 1.6 using modular approach?

Is it possible to create module which follow the modular approach?
Can we also create custom hook in Prestashop 1.6?
In PrestaShop Version 1.6 you are able to create your own custom hooks.
In your module.php install() function you can register a new custom hook like this:
$this->registerHook('NameOfHook');
To assign the hook e.g. in a template file. You just need to add the following code:
{hook h='NameOfHook' mod='yourModuleName'}
Note: In version 1.6 its not neccessary anymore to insert the hook into the hooks table. Presta will do this automatically if the registered hook doesn't exists now.
For the modular approach please have a look at the following links:
http://doc.prestashop.com/display/PS16/Creating+a+first+module
http://doc.prestashop.com/display/PS16/Coding+Standards
Some other usefull links for you might be:
http://doc.prestashop.com/display/PS16/Managing+Hooks

Zend 2 Skeleton. Customize Application module or create own module?

I downloaded the Zend 2 Skeleton Application which comes with the module "Application". This module is the central point of the "Framework".
Now I want to add some routes/pages like "terms", "contact" etc. That brings me to the essential question:
Is it best practise to customize the "Application" module or am I supposed to create my own module? Especially if I want to add some static pages? If I'm gonna customize the Application module I can't update the Framework via composer anymore, I guess.
Thanks for everyone's help.
It depends. If you wanna edit this "static pages" via wysiwyg make separate module for pages (CMS ?)
If you will have pure static pages just add new controllers to Application.
Current trend is to make API in backend and use some frontend framework for front (so front-end will be responsible for load proper views)

How does Grails resolve Controller name conflicts?

What is the recommended approach when an application Controller name conflicts with the name of a plugin's Controller?
I've seen these Grails JIRAs:
GRAILS-4240
GRAILS-1243
...and Burt Beckwith's replies to these two threads imply that the only recourse is to rename one of the Controllers (presumably the application Controller since hacking plugin code is not desirable)
How to use the package name to differentiate between classes in grails?
How to extend/override controller actions of plugins?
However, Burt's own spring-security-ui plugin advocates the exact approach of naming an application Controller the same as a plugin Controller - see spring-security-ui docs.
This approach actually seems to work in both development mode (grails run-app) and when the app is deployed as a WAR. So can this functionality be depended on? If so, what is the Controller conflict resolution rule? The grails docs do not make any mention of it. Perhasps Burt can share his insight?
Having a "plugin" architecture like grails' without even a basic namespacing facility to handle conflicts like this seems pretty broken to me...
The problem is that while you can use packages for any artifact, the convention for controllers is to remove the package and "Controller" to create URLs, e.g. PersonController -> /appname/person/action_name. So in effect everything gets flattened.
In 1.2 and more so in 1.3 things were changed so plugins are compiled separately from application code (and are compiled first) and this gives you the opportunity to replace a plugin artifact with the application's version. Since you shouldn't edit plugin code, this gives you the flexibility to extend or replace a plugin artifact just by using the same name.
I tend to use UrlMappings to get around stuff like this when there are two similarly named controllers. For example say you have an admin UserController that allows low-level CRUD actions and a regular UserController that users work with. I'd name the admin controller AdminUserController and map it to /admin/user/* and leave UserController as is. The admin GSPs will be in views/adminUser and the others will be in views/user so there's no conflict there. This has the added benefit of being able to easily secure - map /admin/** -> ROLE_ADMIN. The conventions are convenient, but this is a simple configuration step that solves this issue for me.
The good news is that GRAILS-1243 will definitely be implemented in 2.0 and possibly in 1.4. And the plugin that Kim Betti references in the comments of GRAILS-1243 looks interesting.

Open Discussion - Symfony - what do you do to start your projects quicker?

When you start a new project (whether it's personal or professional) what do you have at hand to quickly start developing the project?
For example, when I start a new project at work, I have the following already setup from a custom sandbox:
Two different authentication classes, LDAP and CAS which I can change via app.yml
Custom form widgets which I use across most applications
Capistrano deployment script for deploying the project to staging or production servers.
A mail template class which uses an XML file for the templates to send emails
Mail server, ldap etc. settings all configured.
Bunch of icons and the same CSS (which with some exceptions is always the same for each project)
custom error pages, layouts, login layout etc.
static pages such as about, contact us etc.
Useful plugins such as sfFormExtraPlugin, twig etc.
jquery and jQuery UI libraries
Basic local ACL and translation model classes and some other default models.
Tasks - send email task and build translations.
custom tools class for doing some custom stuff
custom factories and some default routes
helpers which I will most probably use are enabled by default (i18n, partial etc.)
And some other things :-)
I'm just wondering what you do to make your development quicker and more efficient when starting a new project. Hopefully I'll learn some new things from what you do.
Thanks folks!
Great question and great list. Here's some more:
As a general practice, whenever we develop a feature that could be used across projects, we develop it as a plugin so it can be easily dropped into other projects.
Custom form formatter that uses our own widget/validators in place of the default Symfony ones.
Custom mailer with support for sending processing templates as emails and better HTML email support.
Plugin for minimizing/combining CSS and JS assets.
Symlink from web/sf to lib/vendor/symfony/data/web. Better than an alias in apache.
Custom admin generator templates.
Quick setup script that takes commandline options or read a config file to create full local dev env (init the project, setup a vhost, modify etc/hosts, import to svn, create svn externals for Symfony and key plugins like sfDoctrineGuard)
Custom Project skeleton
Custom Javascript helper based on Apostrophes new a_js_*() helper functions

Resources