Re: [fw-general] CMS based on ZF2

2014-09-05 Thread Matus Zeman
Hi there,
Kapitchi CMS as it is presented on the site is not under development
anymore (I know -- we should update it to avoid confusion).
We're switching to Apigility/AngularJS/Ionic development only. We've got
several Apigility modules in the queue to be shared with a community soon.
I'll keep you updated.

Matus


On 5 September 2014 11:06, Pierre Rambaud 
wrote:

> Hi,
>
> After a quick search on google:
>
> - https://got-cms.com
> - http://www.ejoom.com/libra-cms/en/
> - http://kapitchi.com/
> - http://www.rubedo-project.org/
>
> Regards
>
>
> 2014-09-05 10:59 GMT+02:00 Laurent Mirguet  >:
>
> > Hello guys,
> >
> > Is there a list somewhere of the various CMSes based on ZF2?
> >
> > Thank you
> > Laurent
> >
> > --
> > List: fw-general@lists.zend.com
> > Info: http://framework.zend.com/archives
> > Unsubscribe: fw-general-unsubscr...@lists.zend.com
> >
> >
> >
>
>
> --
> Pierre Rambaud
> Website: http://pierrerambaud.com 
> G+: https://plus.google.com/u/0/107809758756474139920/posts
> Github: https://github.com/PierreRambaud
>


Re: [fw-general] Customizing user module in zend framework2

2014-01-29 Thread Matus Zeman
>From what I understand your priority is to learn ZF2.
Both ZF2 and other modules like ZfcUser would teach you something new.
For sake of learning of ZF2 I'd probably try to implement something from
scratch while studying all other modules relevant to your requirements. All
of them has got something you can learn from.

Matus


On 29 January 2014 20:40, kirens...@yahoo.com  wrote:

> I am a zend frame work1 developer. I am trying to study zf2. But I came to
> know that zend1 and zend2 are entirely different. I am trying to build a
> simple application in which following features need to be implemented.
>
> a) user registration and authentication
>
> b) acl
>
> I implemented zend skeleton.Now I am planning to implement user
> registration
> and authentication. For this I have 2 option
>
> 1) use already developed module like ZfcUser
>
> 2) develop new module for registration and authentication.
>
> If I choose Ist method I have to study the whole concept of module ZfcUser
> for its customization. Which I felt difficulty in grasping the things like
> entity, mapper, service etc. So I am planning to go for my own auth and
> registration module.I am going to develop these as mentioned in Album
> module.
>
> Can any one please help me to choose the right method?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Customizing-user-module-in-zend-framework2-tp4661562.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Translation of complex views

2013-08-08 Thread Matus Zeman
I'd say instead of struggling with tons of message ids just use text itself
as translation "ID" and problem solved. Then use tools like gettext/PoEdit
to scan though the project source files.
You really don't want to create different view scripts for different
languages -- unless it really necessary and other translation techniques
fails -- as this would introduce duplicating of your presentation logic
which you want to avoid!
With this approach you get few benefits for you as developer like: you
don't have to think much about translation when implementing new features.
Just make sure you use $this->translate() method. You don't have to
'manage' message IDs (questions like what's the best name for it so I don't
violate naming conventions? etc, etc, etc). Basically you don't care about
translation until your application needs to be translated - then you just
scan the project and hand over .po file to translators to edit.

Matus


On 9 August 2013 05:11, Andreas Möller  wrote:

> Hello, fellow developers,
>
>
> this is likely a question that's framework-agnostic: how do you approach
> translation of complex views?
>
> I'm not so sure which is a bigger nightmare:
>
> * struggling with tons of translation message ids and translations
> * duplicating view scripts, splicing in the locale/language in the
> filename ("index.phtml" becomes "index.en.phtml", "index.de.phtml" etc),
> and implementing an appropriate template resolver strategy or similarly
> ensure the appropriate view script is chosen
>
> What are your experiences if you've got any you're willing to share?
>
>
> Best regards,
>
> Andreas
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: Controller Plugin for service all in one or ....

2013-06-24 Thread Matus Zeman
Hi Fabio,
I really depends what helper/plugin you're implementing I believe. Do you
want to implement some application logic there using multiple services? I'd
rather move it into service class itself.
>From your code snipped it looks like you use them just to get service
instances - why not to inject these directly into your
controllers wherever needed?
On another hand in view part we like to implement (view) plugins that is
one per entity/service. They are mostly used to retrieve entity by ID in
the view (strictly read only obviously) or implements another entity
related "helper" methods.

Some examples:
https://github.com/kapitchi/KapMessage/tree/master/src/KapMessage/View/Helper
https://github.com/kapitchi/KapitchiContact/blob/master/src/KapitchiContact/View/Helper/Contact.php
Plugins above extends from:
https://github.com/kapitchi/KapitchiEntity/blob/master/src/KapitchiEntity/View/Helper/AbstractEntityHelper.php

Matus


On 25 June 2013 04:27, whisher  wrote:

> Hi weierophinney thanks for the reply.
>
> https://gist.github.com/whisher/5853740
>
>
> Bye.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Re-Controller-Plugin-for-service-all-in-one-or-tp4660427p4660447.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: zf2 - FlashMessenger not rendering messages

2013-06-24 Thread Matus Zeman
Hi Tony and Matthew,
you can also access "current" messages - the messages set in the current
request.
We usually implement it the way that we merge current messages with
messages from previous request (session) and display them. You need to
clearCurrentMessages once you use them otherwise they appear again in next
request.
This should be working:
https://github.com/kapitchi/KapitchiShowcaseApplication/blob/master/module/KapBootstrapTheme/view/layout/partial/user-messages.phtml

Matus


On 25 June 2013 04:59, Matthew Weier O'Phinney  wrote:

> On Mon, Jun 24, 2013 at 4:27 PM, tonystamp 
> wrote:
> > Agree. So does the redirect controller plugin not constitute another
> request?
>
> Only if you return and send the response immediately. If you're still
> returning a view model/array from your controller, you'll run into
> issues. It's only on the next request, to the page you're redirected
> to, that the messages you put in the FlashMessenger will be
> accessible.
>
>
> --
> Matthew Weier O'Phinney
> Project Lead| matt...@zend.com
> Zend Framework  | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] [zf2] Help me understand routing

2013-05-27 Thread Matus Zeman
Have you tried adding 'create' route after 'profile' one?

Matus


On 28 May 2013 08:41, Xander Guzman  wrote:

> I have the following route defined
>
> 'campaigns' => array(
> 'type'=> 'Zend\Mvc\Router\Http\Literal',
> 'options' => array(
> 'route'=> 'campaigns',
> 'defaults' => array(
> 'controller' =>
> 'Application\Controller\Campaigns',
> 'action' => 'index',
> ),
> ),
> 'may_terminate' => true,
> 'child_routes' => array(
> 'create' => array(
> 'type'  => 'Zend\Mvc\Router\Http\Literal',
> 'options' => array(
> 'route'  => '/create',
> 'action' => 'create',
> ),
> ),
> 'profile' => array(
> 'type'=>
> 'Zend\Mvc\Router\Http\Segment',
> 'options' => array(
> 'route'=> '/:campaign-slug',
> 'defaults' => array(
> 'action' => 'campaign',
> ),
> ),
> 'may_terminate' => true,
> 'child_routes' => array()
> ),
>
> My problem is the way I'm understanding it if I type in /campaigns/create
> it should map to /create and if I enter anything else
> /campaigns/foofoobunny that should match the /:campaign-slug route. Problem
> is that it doesn't work, why is this? How could I make it so if I define an
> explicit route it will match and if it doesn't it falls back to this
> default dynamic route?
>


[fw-general] Re: ZF2.2 form element name wrapping behaviour change

2013-05-21 Thread Matus Zeman
Any comments on this as it's very important feature to be discussed I
believe?

Matus


On 20 May 2013 21:04, Matus Zeman  wrote:

> Hi there,
> It looks like form element name "wrapping" does not work as in previous
> versions of ZF2.
> It's related to this commit:
> https://github.com/zendframework/zf2/commit/768c3d8347bd76ae86f1a6832e374cbe12c2cef1
>
> To explain:
> Pre version 2.2:
> When you added "child" Form into a Form all element names (of child form)
> were prefixed by parent form name automatically and parent form elements
> were not prefixed at all - I considered this as logical and correct
> behaviour (maybe not?).
>
> In version 2.2:
> Either child form element names are not prefixed
> OR
> When I set setWrapElements(true) on the parent form all elements are
> prefixed including child ones so I would have e.g. registration[id],
> registration[auth_credential][identity],
> registration[auth_credential][password]...
>
> Is this intended behaviour? It hasn't been like in any of earlier versions
> of ZF2.
> If it is, what's the best way how to achieve pre 2.2 behaviour?
>
> Cheers,
> Matus
>


[fw-general] ZF2.2 form element name wrapping behaviour change

2013-05-20 Thread Matus Zeman
Hi there,
It looks like form element name "wrapping" does not work as in previous
versions of ZF2.
It's related to this commit:
https://github.com/zendframework/zf2/commit/768c3d8347bd76ae86f1a6832e374cbe12c2cef1

To explain:
Pre version 2.2:
When you added "child" Form into a Form all element names (of child form)
were prefixed by parent form name automatically and parent form elements
were not prefixed at all - I considered this as logical and correct
behaviour (maybe not?).

In version 2.2:
Either child form element names are not prefixed
OR
When I set setWrapElements(true) on the parent form all elements are
prefixed including child ones so I would have e.g. registration[id],
registration[auth_credential][identity],
registration[auth_credential][password]...

Is this intended behaviour? It hasn't been like in any of earlier versions
of ZF2.
If it is, what's the best way how to achieve pre 2.2 behaviour?

Cheers,
Matus


Re: [fw-general] Re: template names with dots in name aren't possible after Update to ZF2 2.2

2013-05-20 Thread Matus Zeman
Hi there,
not related to View component but it looks like that forms stopped working
as they used to in previous versions.
It's related to this commit:
https://github.com/zendframework/zf2/commit/768c3d8347bd76ae86f1a6832e374cbe12c2cef1

To explain:
Pre version 2.2:
When you added "child" Form into a Form all element names (of child form)
were prefixed by parent form name automatically and parent form elements
were not prefixed at all - I considered this as logical and correct
behaviour (maybe not?).

In version 2.2:
Either child form element names are not prefixed
OR
When I set setWrapElements(true) on the parent form all elements are
prefixed including child ones so I would have e.g. registration[id],
registration[auth_credential][identity],
registration[auth_credential][password]...

Is this intended behaviour? It hasn't been like in any of earlier versions
of ZF2.
If it is, what's the best way how to achieve pre 2.2 behaviour?

Matus



On 20 May 2013 18:43, Bart van der Linden  wrote:

> I have the same problem after upgrading to ZF2.2And I can trace it back to
> the Zend\View\Resolver\TemplatePathStack::resolve method.In 2.1.5 resolve
> on
> line 299 tests for: if (pathinfo($name, PATHINFO_EXTENSION) !=
> $defaultSuffix)in 2.2.0 this is changed to on line 302if
> (pathinfo($name, PATHINFO_EXTENSION) == '')So with a dot in the name no
> defaultSuffix will be appended.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/template-names-with-dots-in-name-aren-t-possible-after-Update-to-ZF2-2-2-tp4660031p4660074.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] ZF2 - Model with camelCase variables and edit form

2013-05-17 Thread Matus Zeman
Hi Michael,
Check usage of Zend\Stdlib\Hydrator's... they are supposed to do all this
magic for you.

I personally don't like when they translate camelCase to underscores by
default but that's another topic.

Cheers,
Matus


On 17 May 2013 15:47, MichaelB  wrote:

> Hi all,
>
> How to fill a form with $form->bind($mymodel) when we have "camelCase"
> proprety in model ?
>
> I use many fields in database with underscore (ex: food_name, is_active,
> create_date, ...).
> In my model in ZF2 i use camelCase variable like $foodName, $isActive, ...
> In my form i use name with underscore like in the database (ex: food_name,
> is_active, create_date, ...)
>
> In the function exchangeArray in my model is like below and work well:
> ...
> $this->foodName = (isset($data['food_name'])) ? $data['food_name'] : null;
> ...
>
> Now arrive my problem.. I have a form with some fields. Is the "edit" form
> so data from database have to fill the form and use $form->bind($mymodel)
> BUT all fields with underscore DO NOT FILL because foodName != food_name.
>
> I must use it for each of my fields to fill my edit form:
> $form->get('food_name')->setAttribute('value', $mymodel->foodName);
>
>
> I would like to know if is right ? Or have another solution ?
>
>
> In the doc is only simple variable like id, title, ... but in majority of
> project have more complicate variable name.
>
> Thanks in advance,
> Michael
>
> PS: I hope is clear explanation from my part.
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Model-with-camelCase-variables-and-edit-form-tp4660045.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: [ZF2] How to use paginator with huge number of records

2013-04-09 Thread Matus Zeman
Hi Sinimix,
I don't like to complicate the things by pre-loading models/entities as you
never know how "far" you're going to use them at the end - do I display the
author or not? etc etc...
We've got entity view helpers instead which I use as needed to retrieve
additional data/entities in view templates. Following MVC paradigm there
should not nothing wrong doing this as long as you read only from
models/services.
Our indexAction usually returns paginator (fully set up - like what page,
items per page, ...) of relevant entities and then we would just load
author entity if needed in the view template.
e.g. $author = $this->author()->find($book->getAuthorId());

Cheers,
Matus


On 9 April 2013 18:35, sinimix  wrote:

> Robert,
>
> Thank you for the quick response (ili mozda da kazem hvala ;-)
>
> The problem is that I already implemented the logic you suggested, but it
> doesn't suit my current needs. Namely, I need to perform additional logic
> on
> results before I use them in the paginator. For example, in this particular
> case I need to set information about authors for every book in the
> resultset:
>
> ...
> public function getBooks($currentPage)
> {
> $select = new Select;
> $select->from('book');
>
> $resultSet = $this->select($select);
> $resultSet->buffer();
> $resultSet->next();
>
> *foreach($resultSet as $book) {
> // Set author information for each book, e.g.
> $book->setAuthor($someAuthor);
> }*
>
> $iteratorAdapter = new Iterator($resultSet);
> $paginator = new Paginator($iteratorAdapter);
> $paginator->setItemCountPerPage(10);
> $paginator->setCurrentPageNumber($currentPage);
>
> return $paginator;
> }
> ...
>
> I'm not sure whether is it possible if the adapter is used directly in the
> paginator.
>
> Or maybe I missed something?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-How-to-use-paginator-with-huge-number-of-records-tp4659675p4659677.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] [ZF2] Enable additional modules in local development environment

2012-10-24 Thread Matus Zeman
TBH I think more fail-safe solution is without is_array check - considering
the contract of config file - it should always return an array. You would
discover an error if some in the file quicker.

On Wed, Oct 24, 2012 at 9:45 AM, Christian Ebert wrote:

> Hi Matus,
>
> great to hear. I modified my solution accordingly so that the logic is
> similar to the global.php/local.php solution and more fail-safe.
>
> $appConfig = require 'config/application.config.php';
>
> if(is_readable('config/application.config.local.php')){
> $localAppConfig = require 'config/application.config.local.php';
> if(is_array($localAppConfig)){
> $appConfig =
> array_merge_recursive($appConfig,$localAppConfig);
> }
> }
>
> // Run the application!
> Zend\Mvc\Application::init($appConfig)->run();
>
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] [ZF2] Enable additional modules in local development environment

2012-10-24 Thread Matus Zeman
Hi Chris,
It's (almost) same to what I do also - I don't think you might need
something more elegant.

// Get application stack configuration
$configuration = include 'config/application.config.php';

//loads local config if available
if(is_readable('config/application.local.php')) {
$localConfig = include 'config/application.local.php';
$configuration = array_merge_recursive($configuration, $localConfig);
}

Matus

On Wed, Oct 24, 2012 at 9:26 AM, Christian Ebert wrote:

> Hi,
>
>
>
> I want to enable certain modules - e.g. developer tools - solely on the
> local development environment. Currently I am loading my modules using
> application.config.php in index.php as shown in the skeleton application.
> Which is the recommended way to add certain modules for the local
> (development) environment only? I already tried to add them in local.php,
> but that does obviously not work. Is there any dedicated mechanism to
> provide them more or less automatically similar to global.php/local.php
> logic with the config settings? I came up with the following solution in
> index.php but would love to see a more elegant solution:
>
>
>
> $appConfig = require 'config/application.config.php';
>
>
>
> if(file_exists('config/autoload/local.php')){
>
> $localAppConfig = require 'config/autoload/local.php';
>
> if(is_array($localAppConfig) AND
> array_key_exists('modules',$localAppConfig)){
>
>// specific modules for development
> environment are loaded before general available modules are loaded
>
> $appConfig['modules'] =
> array_merge($localAppConfig['modules'],$appConfig['modules']);
>
> }
>
> }
>
>
>
> // Run the application!
>
> Zend\Mvc\Application::init($appConfig)->run();
>
>
>
> Best Regards
>
> Christian
>
>


Re: [fw-general] ZF2 Module / Application setup

2012-10-12 Thread Matus Zeman
Hi natix,
I'd go with option 3 and have separate index.php files for each
domain/application, while:
- share same set of modules on both applications
- have separate app. configurations - so they bootstrap modules they need
only.
- Have controllers "mixed" - it's ACL of your application which defines if
it's "admin" controller or not. There might be another application where
your originally "admin" controller will fit the purpose on front-end
application - you'd just define ACL differently.
- have one (more?) module which is application specific - copy of
Application module from ZendSkeletonApplication; I usually call them by
application name with postfix "App" e.g. KapitchiApp. This module
implements application specific stuff only e.g. listen to module events and
modifies functionality as your application needs. I also specify whole ACL
here.
- Have one separate module which implements "theme" - so designer plays
with templates in this one module only and does not have to search much.

These are only recommendations from my own experience - not necessary
generally accepted solution for your scenario.

Matus

On Fri, Oct 12, 2012 at 3:05 PM, natix  wrote:

> I am trying to get myself into ZF2 but the whole idea of Modules still
> seams
> to elude me.
>
> I have a admin section that is under its own domain (admin.example.com)
> and
> then I have a users section under www.example.com. In ZF1, I have always
> put
> each one in its own Module - so that I have a "admin" module with its own
> models, controllers, etc (same for the users module).
>
> Now in ZF2, it seams this idea has changed a bit and I am unsure of what
> would be the best way to go about it. The admin section isn't so much a CMS
> as it is a database data manager, but it still has many sections and the
> most complex stuff there. The users section just bring all the appropriate
> data together and displays it in a pretty layout.
>
> So, what would be the best way to structure my code? My ideas so far have
> been:
>
> 1) Create a separate Application for each section and only share the Zend
> library between them
>
> 2) Each section gets its own Module, the same way as I was doing with ZF1
>
> 3) Split things up into different Modules that are related. For example
> making a Companies module that has the controller for the admin section as
> well as the controller for the users section.
>
> #1 seams a bit...odd. Most of the configuration is the same for these
> sections so it seams strange to do it that way.
>
> #2 seams to make the most sense to me but I don't think this is the way
> modules were meant to be used in ZF2
>
> #3 doesn't seam to make a lot of sense for me. How do I control access to
> the different controllers in each module, why am I loading the admin module
> when I just want the users module, etc etc. Although, from what I have been
> reading, this seams to be the way it was intended to be used I just dont
> see
> it as a good idea.
>
> If anyone can give me some advice I would be greatly appreciative.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Module-Application-setup-tp4657549.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Inject db connection into not-zend libraries

2012-09-19 Thread Matus Zeman
I'd say refactor the code to use service manager and all of the sudden it
would be all clear to you.
Btw how does your static method act as - as factory?

Matus

On Wed, Sep 19, 2012 at 12:25 PM, elk  wrote:

> Hello everyone,
>
> could you please point me to the right direction with this issue? Let me
> briefly describe the situation. From my previous project I've got a few
> classes (CLASS_A, CLASS_B, ...) I want to reuse. I grouped them into a
> Module.
>
> 1) In a controller (in another Module), I call a static method of CLASS_A.
> 2) This method creates an object of CLASS_B and calls its methods.
> 3) Methods of CLASS_B need a database connection.
>
> What would be the best way to archieve this. So far I tried many things,
> but
> none did the trick. I just cant find a way, how to get the database
> connection into Class_B and call its methods from static method of the
> Class_A ...
>
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Inject-db-connection-into-not-zend-libraries-tp4656927.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: ZF2 Doing something before calling the controller action

2012-09-19 Thread Matus Zeman
Hi Distrust,
Why can't you simply implement it inside of  showSettingsAction() method?
You NEVER want to fetch data when controller instance is
created immediately.
In case you want to re-use some logic in other actions (not really your
case as you call fetchAll() only) you have got more options:
- create protected method inside of the same controller
- service methods (in your case it would be SettingsTable class?)
- controller helpers
- ...?

To follow Mike's answer (and don't think it's correct in your use case) -
do not mix service (controller) factory with other logic as he proposed.
You can overwrite protected method attachDefaultListeners() in your
controller
https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/Controller/AbstractController.php#L304
and
attach listeners you need there or use shared event manager?

Matus


On Wed, Sep 19, 2012 at 11:39 AM, luk  wrote:

> Distrust wrote
> > What can I do to initialize (do some stuff) before calling the controller
> > action?
> > Zend have init() function, but Zend 2 doesn't. So that (for example):
> >
> > class BaseController extends AbstractActionController
> > {
> >   protected $settings_table;
> >   protected $settings;
> >
> >   public function __construct()
> >   {
> >   $this->settings = $this->getSettingsTable()->fetchAll();
> >   }
> >
> >   public function getSettingsTable()
> >   {
> >   if (!$this->settings_table)
> >   {
> >   $sm = $this->getServiceLocator();
> >   $this->settings_table =
> $sm->get('Application\Model\SettingsTable');
> >   }
> >
> >   return $this->settings_table;
> >   }
> > }
> >
> > class TestController extends BaseController
> > {
> >   // ...
> >
> >   public function showSettingsAction()
> >   {
> >   return new ViewModel(array(
> >   'settings' => $this->settings
> >   ));
> >   }
> > }
> >
> > won't work, because the objects have not been created yet.
>
> To achieve that you would need to listen on the dispatch Event with high
> priority that is being executed prior to any Contoller logic. Please try
> this code in your Module.php.
>
> namespace ModuleName;
>
> use ModuleNama\Controller\MyController;
> use Zend\EventManager\EventManagerInterface;
>
> class Module
> {
>
> public function getControllerConfig()
> {
> return array(
> 'factories'  => array(
> 'ModuleName\Controller\MyController' =>
> function($sm) {
> $events =
> $sm->getServiceLocator()->get('EventManager');
> $controller = new MyController();
> $events->attach('dispatch',
> function ($e) use ($controller) {
> $request =
> $e->getRequest();
> $method  =
> $request->getMethod();
>
> // your own initialization
> logic here
> if
> ($controller->params()->fromRoute('paramName', false)) {
> return;
> }
> }, 100); // run before controller
> action logic
>
>
> $controller->setEventManager($events);
> return $controller;
> }
> ),
> );
> }
> }
>
>
>
>
> -
> Cheers,
> --
> Luke Mierzwa
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Doing-something-before-calling-the-controller-action-tp4656922p4656923.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Zend Framework Component Marketplace

2012-05-04 Thread Matus Zeman
Hi Konr,
If you're looking for ZF2 stuff this might be good starting point:
http://modules.zendframework.com/ but unfortunately you can't buy it --
it's all for free!!! ;)
What are you looking for in particular? If you have some specific
requirements let me know and I might be able to develop it for you.

Cheers,
Matus

On Thu, May 3, 2012 at 9:15 PM, Konr Ness  wrote:

> Does anyone know of a marketplace where one can buy libraries, plugins,
> modules, etc? Especially things for Zend Framework?
>
> I have found http://www.binpress.com/ which has several Zend Framework
> components. Any others?
>
> Konr
>