shiva8
shiva8

Reputation: 2162

How to migrate Zend Framework plugins to Zend Framework 2 application skeleton

I got Akrabat's tutorial working with doctrine 2 modules.

I'm trying to figure out how to migrate plugins, action helpers, view helpers etc to Zend Framework 2. There seems to be no tutorials or blog articles regarding this...

Upvotes: 2

Views: 911

Answers (1)

superdweebie
superdweebie

Reputation: 1576

Lots of your code will likely remain the same. It's more like refactoring than rewriting.

For plugins, use the new event system. Register an event listener to fire and do something when the event you are interested in occurs. There is an example of a simple listener to set up the view in the Skeleton Application. There are lots of events you can listen to - lots more flexibility than zf1 - and you can add your own events too.

For action helpers, write your class that does things and inject it into your controller using the DIC. There are lots of injection examples floating around the web. It's much simpler than zf1 really.

For view helpers, it's almost the same as zf1. Subclass from AbstractHelper, and then register that helper in the DI config. You'll find instructions in the zf2 user docs.

I know these comments aren't an exhaustive tutorial, but it should get you started in the right direction.

Upvotes: 1

Related Questions