[fw-general] AbstractRestfulController not found resource best way
Hi, -I'm wondering what's the best way 1) public function get($id) { $entity = $this-getMapper()-fetchById($id); if(is_bool($entity) !$entity){ return $this-getResponse()-setStatusCode(404); } return new JsonModel(array( 'status'=200, 'data' = $entity-toArray() ) )); } 2) public function get($id) { $entity = $this-getMapper()-fetchById($id); if(is_bool($entity) !$entity){ $this-getResponse()-setStatusCode(404); return new JsonModel(array( array( 'status' = 404, 'error'='Not Found') )); } return new JsonModel(array( array( 'status'=200, 'data' = $entity-toArray() ) )); } -Is it possible manage it by the model ? -Is there a way to avoid this {0:{status:404,error:Not Found},message:Page not found.,reason:error-controller-cannot-dispatch,display_exceptions:true,controller:FbswitRest\\Controller\\PhotoController,controller_class:null} an get only [{status:404,error:Not Found},message:Page not found.}] Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/AbstractRestfulController-not-found-resource-best-way-tp4660975.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
[fw-general] Re: AbstractRestfulController not found resource best way
samsonasik wrote hm.., maybe like this ? $this-getResponse()-setStatusCode(404); $this-getResponse()-setContent(json_encode(array( 'status' = $this-getResponse()-getStatusCode(), 'error' ='Not Found', 'message' = 'Page not found.' ))); $this-getResponse()-getHeaders() -addHeaderLine('content-type', 'application/json'); return $this-getResponse(); hm... not very clean (I'd like use JsonModel) but if I don't found any other way ^^ -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/AbstractRestfulController-not-found-resource-best-way-tp4660975p4660980.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
[fw-general] [OT] helpers url absolute vs relative
Hi, I notice that other framework like laravel if you using helpers give you an absolute url while zf2 give you relative url so I'm wondering what are the pros and cons. Thanks in advance and sorry for the ot ^^ Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/OT-helpers-url-absolute-vs-relative-tp4660901.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
[fw-general] Re: Controller Plugin for service all in one or ....
Hi Matus thanks both for the reply and the useful links. Matus Zeman wrote why not to inject these directly into your controllers wherever needed? I prefer using a controller plugin because I can use it accross all my modules. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Re-Controller-Plugin-for-service-all-in-one-or-tp4660427p4660460.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
[fw-general] Re: Controller Plugin for service all in one or ....
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
[fw-general] Controller Plugin for service all in one or ....
Hi, I'm wondering what's the best way to implement Controller Plugin Do I put all the services in a single plugin with an unique key in getControllerPluginConfig or put each service in a dedicate plugin and key ? Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Controller-Plugin-for-service-all-in-one-or-tp4660413.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
[fw-general] Re: How to deploy skeleton application without composer
Thanks everybody following the getting started doc I've forgotten the old fashion way ^^ -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184p4660191.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
[fw-general] How to deploy skeleton application without composer
Hi, It's the buzz word nowday :) but what's the way to install skeleton application without composer ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184.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
[fw-general] Re: How to deploy skeleton application without composer
Thanks :) but if don't us composer init_autoloader do all the work ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184p4660186.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
[fw-general] zend 2 pagination control route default action
Hi, module.config.php router' = array( 'routes' = array( 'btitadmin_route' = array( 'type' = 'literal', 'options' = array( 'route'= '/admin', 'defaults' = array( 'controller' = 'BtitAdmin\Controller\AdminController', 'action' = 'index', ), ), 'may_terminate' = true, 'child_routes' = array( 'user' = array( 'type' = 'segment', 'options' = array( 'route' = '/user[/:action][/id/:id][/page/:page]', 'constraints' = array( 'action' = '[a-zA-Z][a-zA-Z0-9_-]*', 'id' = '[0-9]+', 'page' = '[0-9]+', ), 'defaults' = array( 'controller' = 'BtitAdmin\Controller\UserController', 'action' = 'index', 'id'=0, 'page'=1 ), ), ), BtitAdmin/view/btit-admin/user/index.phtml echo $this-paginationControl( $paginator, 'Sliding', '/partial/paginator',array('route' ='btitadmin_route/user') ); BtitAdmin/view/btit-admin/partial/paginator.phtml echo $this-url($this-route, array('page' = $page)); the problem is when I click on the link I got admin/user/page/2 instead of admin/user/index/page/2 Can you help me,please ? Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-pagination-control-route-default-action-tp4660004.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
[fw-general] Re: zend 2 pagination control route default action
thx just a lot for the point :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-pagination-control-route-default-action-tp4660004p4660007.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
[fw-general] Zend 2 - entity/model/mapper/service front end back end best practice
Hi all, I'd like to know what's the best practice to manage entity/model/mapper/service in for instance Blog Admin modules. I should set up different entity/model/mapper/service or share all the stuff from within my Admin module ? Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-2-entity-model-mapper-service-front-end-back-end-best-practice-tp4659998.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
[fw-general] Re: [ZF2] Help needed to understand this navigation behaviour
btw I found out http://framework.zend.com/manual/2.1/en/tutorials/tutorial.navigation.html a short cut as well instead of define child routes you can do like: return array( ... 'navigation' = array( 'default' = array( array( 'label' = 'Home', 'route' = 'home', ), array( 'label' = 'Album', 'route' = 'album', 'pages' = array( array( 'label' = 'Add', 'route' = 'album', 'action' = 'add', ), array( 'label' = 'Edit', 'route' = 'album', 'action' = 'edit', ), array( 'label' = 'Delete', 'route' = 'album', 'action' = 'delete', ), ), ), ), ), ... ); -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Help-needed-to-understand-this-navigation-behaviour-tp4659974p4659993.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
[fw-general] Re: [ZF2] Help needed to understand this navigation behaviour
Razorblade wrote [..] 'navigation' = array( 'default' = array( array( 'label' = 'Home', 'route' = 'home', ), array( 'label' = 'Page #1', 'uri' = '#', try with Hi, from the reference array( 'label' = 'Home', 'route' = 'home', ), array( 'label' = 'Page #1', 'route' = 'default', and get rid of uri. Hope this helps. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Help-needed-to-understand-this-navigation-behaviour-tp4659974p4659975.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
[fw-general] Re: [ZF2] Help needed to understand this navigation behaviour
Razorblade wrote Hi Whisher, but 'default' route how should be? if you are in skelepton is in Application module config/module.config.php -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Help-needed-to-understand-this-navigation-behaviour-tp4659974p4659977.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
[fw-general] Zend 2 routes literal + child routes segment doesn't work
Hi all, in my module.config.php return array( 'controllers' = array( 'invokables' = array( 'BtitAdmin\Controller\AdminController' = 'BtitAdmin\Controller\AdminController', 'BtitAdmin\Controller\UserController' = 'BtitAdmin\Controller\UserController', 'BtitAdmin\Controller\UserController' = 'BtitAdmin\Controller\MediaController', ), ), 'navigation' = array( 'admin' = array( array( 'label' = 'Home', 'route' = 'btitadmin_route', ), array( 'label' = 'User', 'route' = 'btitadmin_route/user', /*'pages' = array( array( 'label' = 'Child #1', 'route' = 'page-1-child', ), ),*/ ), array( 'label' = 'Media', 'route' = 'btitadmin_route/media', ), ), ), 'router' = array( 'routes' = array( 'btitadmin_route' = array( 'type' = 'literal', 'options' = array( 'route'= '/admin', 'defaults' = array( 'controller' = 'btitadmin_controller_admin', 'action' = 'index', ), ), 'may_terminate' = true, 'child_routes' = array( 'user' = array( 'type' = 'segment', 'options' = array( 'route' = '/user[/:action][/:id]', 'constraints' = array( 'action' = '[a-zA-Z][a-zA-Z0-9_-]*', 'id' = '[0-9]+', ), 'defaults' = array( 'controller' = 'btitadmin_controller_user', 'action' = 'index', 'id'=0 ), ), ), 'media' = array( 'type' = 'Literal', 'options' = array( 'route' = '/media', 'defaults' = array( 'controller' = 'btitadmin_controller_media', 'action' = 'index', ), ), ), ), ), ), ), 'view_manager' = array( 'template_path_stack' = array( 'btitadmin' = __DIR__ . '/../view' ), ), ); admin/user // it works admin/user/test //it works admin/user/test/id/1 //it doesn't work :( I'd like do to know why ? Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-2-routes-literal-child-routes-segment-doesn-t-work-tp4659978.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
[fw-general] zend 2 key name in the config - best practise
Hi, I'm starting naming like like this: 'controllers' = array( 'invokables' = array( 'mymodule_controller_base' = 'mymodule\Controller\BaseController', 'mymodule_controller_test' = 'mymodule\Controller\TestController' ), ), 'router' = array( 'routes' = array( 'mymodule_route' = array( 'type' = 'Zend\Mvc\Router\Http\Literal', 'options' = array( 'route'= '/', 'defaults' = array( 'controller' = 'mymodule_controller_base', 'action' = 'index', ), ), ), I'm wondering if it is acceptable or not. What's the best practise ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-key-name-in-the-config-best-practise-tp4659857.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
[fw-general] Re: Checking identity by Identity Helper
Hi, take a look at http://stackoverflow.com/questions/15483415/zf2-custom-view-helper-stops-execution/15485693#15485693 Hope this helps. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Checking-identity-by-Identity-Helper-tp4659819p4659828.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
[fw-general] zend 2 why namespace aliases for module
Hi, can anyone explain the use of namespace alias for module like use ZfcUser\Module as ZfcUser; (in ZfcUser\Form\Login) when in the class there is no direct reference to it ? Thanks in advance. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-why-namespace-aliases-for-module-tp4659811.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
[fw-general] Re: zend 2 why namespace aliases for module
Marco Pivetta wrote It may well be a leftover of a refactoring. You should also point such emails at the issue tracker of ZfcUser instead (or just open a pull request) Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 21 April 2013 15:47, whisher [via Zend Framework Community] ml-node+s634137n4659811h61@.nabble wrote: Hi, can anyone explain the use of namespace alias for module like use ZfcUser\Module as ZfcUser; (in ZfcUser\Form\Login) when in the class there is no direct reference to it ? Thanks in advance. -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-why-namespace-aliases-for-module-tp4659811.html To start a new topic under Zend Framework, email ml-node+s634137n634138h98@.nabble To unsubscribe from Zend Framework Community, click herelt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codeamp;node=634137amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4gt; . NAMLlt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namlgt; https://github.com/ZF-Commons/ZfcUser/issues/291 done Thanks for the point. we are the nerds ^^ Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-why-namespace-aliases-for-module-tp4659811p4659813.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
[fw-general] Re: Zend 2 View setTemplate dont trigger any errors
[The second listener checks to see if the MvcEvent result is a View Model, and, if so, if it has a template associated with it. If not, it will inspect the controller matched during routing to determine the module namespace and the controller class name, and, if available, it’s “action” parameter in order to create a template name. This will be “module/controller/action”, all normalized to lowercase, dash-separated words.] using setTemplate can be a good way to improve performance ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-2-View-setTemplate-dont-trigger-any-errors-tp4659712p4659716.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
[fw-general] Zend 2 View setTemplate dont trigger any errors
Hi, using this code public function indexAction() { $view = new ViewModel(array( 'message' = 'Hello world', )); $view-setTemplate('foo/baz-bat/do-something-crazy'); return $view; } I'm waiting an error nothing is triggered. So I'm wondering why ^^ Thanks in advance -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-2-View-setTemplate-dont-trigger-any-errors-tp4659712.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
[fw-general] zf2 matched route getParam controller get the module instead
Hi, I'm wondering if it's the wanted behaviour public function onBootstrap(MvcEvent $e) { $eventManager= $e-getApplication()-getEventManager(); $eventManager-attach('route', array($this, 'loadConfiguration'), 2); //you can attach other function need here... } public function loadConfiguration(MvcEvent $e) { $application = $e-getApplication(); $sm= $application-getServiceManager(); $sharedManager = $application-getEventManager()-getSharedManager(); $router = $sm-get('router'); $request = $sm-get('request'); $matchedRoute = $router-match($request); if (null !== $matchedRoute) { // I get module name instead of the controller name var_dump($matchedRoute-getParam('controller')); // do something } } -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zf2-matched-route-getParam-controller-get-the-module-instead-tp4659689.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
[fw-general] Re: zend frmawork 2 layout
Hi, put this error_reporting(-1); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); at the beginning of index.php file -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-frmawork-2-layout-tp4659660p4659672.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
[fw-general] Re: How to dispatch a custom 403 page in ZF2?
Hi, take a look at https://github.com/zendframework/zf2/issues/2604 -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-dispatch-a-custom-403-page-in-ZF2-tp4659654p4659657.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
[fw-general] Re: zend 2 ModuleRouteListener pratical example
whisher wrote Marco Pivetta wrote Heya! The ModuleRouteListener ( https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/ModuleRouteListener.php) prepends the module name to the requested controller name. That's useful if you want to use controller short names in routing :) Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 17 March 2013 18:48, whisher [via Zend Framework Community] ml-node+s634137n4659503h13@.nabble wrote: Hi I can see in the module Application quick start: public function onBootstrap(MvcEvent $e) { $translator = $e-getApplication()-getServiceManager()-get('translator'); $application = $e-getApplication(); $eventManager = $application-getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener-attach($eventManager); } but I can't figure out the use or what's it for. Can you give a pratical exampkle or a short explanation, please ? Bye. -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503.html To start a new topic under Zend Framework, email ml-node+s634137n634138h98@.nabble To unsubscribe from Zend Framework Community, click herelt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codeamp;node=634137amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4gt; . NAMLlt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namlgt; Heya! Thanks! :) Sorry to bother you again but http://stackoverflow.com/questions/13584136/same-controller-name-in-different-modules-in-zf2 http://stackoverflow.com/questions/13584136/same-controller-name-in-different-modules-in-zf2 I picked up the right breadcrumb :) ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503p4659561.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
[fw-general] Re: zend 2 ModuleRouteListener pratical example
Marco Pivetta wrote Heya! The ModuleRouteListener ( https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/ModuleRouteListener.php) prepends the module name to the requested controller name. That's useful if you want to use controller short names in routing :) Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 17 March 2013 18:48, whisher [via Zend Framework Community] ml-node+s634137n4659503h13@.nabble wrote: Hi I can see in the module Application quick start: public function onBootstrap(MvcEvent $e) { $translator = $e-getApplication()-getServiceManager()-get('translator'); $application = $e-getApplication(); $eventManager = $application-getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener-attach($eventManager); } but I can't figure out the use or what's it for. Can you give a pratical exampkle or a short explanation, please ? Bye. -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503.html To start a new topic under Zend Framework, email ml-node+s634137n634138h98@.nabble To unsubscribe from Zend Framework Community, click herelt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codeamp;node=634137amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4gt; . NAMLlt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namlgt; Heya! Thanks! :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503p4659555.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
[fw-general] zend 2 ModuleRouteListener pratical example
Hi I can see in the module Application quick start: public function onBootstrap(MvcEvent $e) { $translator = $e-getApplication()-getServiceManager()-get('translator'); $application = $e-getApplication(); $eventManager = $application-getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener-attach($eventManager); } but I can't figure out the use or what's it for. Can you give a pratical exampkle or a short explanation, please ? Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503.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
[fw-general] Re: Using DI in view helper in ZF 2.1
Hi, take a look at http://blog.evan.pro/creating-a-simple-view-helper-in-zend-framework-2 all in all you can work it out simply with: class Module { public function getViewHelperConfig() { return array( 'factories' = array( // the array key here is the name you will call the view helper by in your view scripts 'absoluteUrl' = function($sm) { $locator = $sm-getServiceLocator(); // $sm is the view helper manager, so we need to fetch the main service manager return new AbsoluteUrl($locator-get('Request')); }, ), ); } } Hope this helps. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Using-DI-in-view-helper-in-ZF-2-1-tp4659474p4659507.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
[fw-general] zend 2 AbstractRestfulController how to manage Exception
Hi, I'm wondering how to manage Exception in AbstractRestfulController I set up the http://hounddog.github.com/blog/getting-started-with-rest-and-zend-framework-2/ project and I've tried with public function create($data) { try{ $artist = $this-getRequest()-getPost('artist', null); $title = $this-getRequest()-getPost('title', null); $album = new Album(); $album-exchangeArray(array('artist'=$artist,'title'=$title)); $id = $this-getAlbumTable()-saveAlbum($album); return $this-get($id); } catch (Exception $e) { return new JsonModel(array( 'meta' =array( 'code'=500, 'error-num'=$e-getCode(), 'error-msg'=$e-getMessage(), ) )); } } and also with public function saveAlbum(Album $album) { try{ $this-tableGateway-insert($data); $id = $this-tableGateway-getLastInsertValue(); return $id; } catch (Exception $e) { return new JsonModel(array( 'meta' =array( 'code'=500, 'error-num'=$e-getCode(), 'error-msg'=$e-getMessage(), ) )); } } but I keeping on having the all Exception stack I mean with the whole layout. My goal is get a json like { meta: { error_type: error type, code: 400, error_message: error msg } } What's the right way ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-AbstractRestfulController-how-to-manage-Exception-tp4659479.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
[fw-general] Re: zend 2 AbstractRestfulController how to manage Exception
Michael Gooden wrote Hi wisher, Matthew Weier O'Phinney has put together a great library called PhlyRestfully. It handles among other things, returning a standardised API-Problem response for exceptions. Contact me directly if you need help implementing it. Regards, Michael Gooden -Original Message- From: whisher lt; whisher06@ gt; Date: Fri, 15 Mar 2013 11:18:11 To: lt; fw-general@.zend gt; Subject: [fw-general] zend 2 AbstractRestfulController how to manage Exception Hi, I'm wondering how to manage Exception in AbstractRestfulController I set up the http://hounddog.github.com/blog/getting-started-with-rest-and-zend-framework-2/ project and I've tried with public function create($data) { try{ $artist = $this-getRequest()-getPost('artist', null); $title = $this-getRequest()-getPost('title', null); $album = new Album(); $album-exchangeArray(array('artist'=$artist,'title'=$title)); $id = $this-getAlbumTable()-saveAlbum($album); return $this-get($id); } catch (Exception $e) { return new JsonModel(array( 'meta' =array( 'code'=500, 'error-num'=$e-getCode(), 'error-msg'=$e-getMessage(), ) )); } } and also with public function saveAlbum(Album $album) { try{ $this-tableGateway-insert($data); $id = $this-tableGateway-getLastInsertValue(); return $id; } catch (Exception $e) { return new JsonModel(array( 'meta' =array( 'code'=500, 'error-num'=$e-getCode(), 'error-msg'=$e-getMessage(), ) )); } } but I keeping on having the all Exception stack I mean with the whole layout. My goal is get a json like { meta: { error_type: error type, code: 400, error_message: error msg } } What's the right way ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-AbstractRestfulController-how-to-manage-Exception-tp4659479.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend Thanks Michael for your kindness. I'm taking a look to Matthew module/code. If I've got troubles I ask for you :) Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-AbstractRestfulController-how-to-manage-Exception-tp4659479p4659485.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
[fw-general] Re: zend 2 custom library
http://zend-framework-community.634137.n4.nabble.com/ZF2-create-own-library-td4657032.html http://zend-framework-community.634137.n4.nabble.com/ZF2-create-own-library-td4657032.html http://www.kdtips.co.nz/blog/2012/10/how-to-add-custom-library-in-your-zend-framework-2-application/ http://www.kdtips.co.nz/blog/2012/10/how-to-add-custom-library-in-your-zend-framework-2-application/ -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-custom-library-tp4659303p4659387.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
[fw-general] zend 2 router in base (Application) module
Hi, this is my route in module.config.php (you read Base but it's like the Application module just to tweak the zend 2 around) 'router' = array( 'routes' = array( 'home' = array( 'type' = 'Zend\Mvc\Router\Http\Literal', 'options' = array( 'route'= '/', 'defaults' = array( 'controller' = 'Base\Controller\Index', 'action' = 'index', ), ), 'may_terminate' = true, 'child_routes' = array( 'default' = array( 'type' = 'Segment', 'options' = array( 'route' = '[:controller[/:action]]', 'constraints' = array( 'controller' = '[a-zA-Z][a-zA-Z0-9_-]*', 'action' = '[a-zA-Z][a-zA-Z0-9_-]*' ), 'defaults' = array( 'action' = 'index', '__NAMESPACE__' = 'Base\Controller' ) ) ) ) ) ) ), the problem is that I put /index or /index/index I get a 404 not found response from the apache (not from the script) what's wrong ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-router-in-base-Application-module-tp4659385.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
[fw-general] Re: ZfcUser Password Hash Mechanism Change
eokorie wrote I have successfully managed to implement zfcUser in a project I am working on. BUt I do have one question, is there a way I can change the password hashing mechanism. I have read the documentation that came with zFcUser and I am aware of the risks involved, but for this purpose, I am trying to keep the passwords the same as they are for the time being until I am convert all my users to a more secure method. The current password system, makes use of a random salt that gets encrypted with sha1 and in turn the passwords in encrypted with the salt and again with sha1. Essentially, the basics of the current encryption system are as follows: 1. random salt ($salt) is encrypted $encrypted_salt = sha1($salt) 2. Submitted password get encrypted along with sha1($encrypted_salt . $givenPassword) How can I modify zfcUser to allow me to keep this method of encrypting my passwords? Many Thanks Hi, afaik zfcUser use Bcrypt for manage password you can peep it in ZfcUser\Authentication\Adapter Db authenticate $fields = $this-getOptions()-getAuthIdentityFields(); while ( !is_object($userObject) count($fields) 0 ) { $mode = array_shift($fields); switch ($mode) { case 'username': $userObject = $this-getMapper()-findByUsername($identity); break; case 'email': $userObject = $this-getMapper()-findByEmail($identity); break; } } $bcrypt = new Bcrypt(); $bcrypt-setCost($this-getOptions()-getPasswordCost()); if (!$bcrypt-verify($credential,$userObject-getPassword())) { // Password does not match $e-setCode(AuthenticationResult::FAILURE_CREDENTIAL_INVALID) -setMessages(array('Supplied credential is invalid.')); $this-setSatisfied(false); return false; } -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZfcUser-Password-Hash-Mechanism-Change-tp4659332p4659335.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
[fw-general] Re: zend 2 EventManager reference
Marco Pivetta wrote If you have a github account, once you edited the file you enter a commit message and Github will open a pull request on its own (basically a request for review and merge). It may not be obvious for newcomers, but it's easier than it looks like, so go on and try :) Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 24 February 2013 22:31, whisher [via Zend Framework Community] ml-node+s634137n4659307h37@.nabble wrote: Marco Pivetta wrote Heya! You can edit that yourself at https://github.com/zendframework/zf2-documentation/edit/master/docs/languages/en/modules/zend.event-manager.event-manager.rst Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 24 February 2013 21:33, whisher [via Zend Framework Community] [hidden email] lt;http://user/SendEmail.jtp?type=nodeamp;node=4659307amp;i=0gt; wrote: Hi, http://framework.zend.com/manual/2.1/en/modules/zend.event-manager.event-manager.html Examples Modifying Arguments new DateTime('now'); should be new \DateTime('now'); Bye -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304.html To start a new topic under Zend Framework, email [hidden email] lt;http://user/SendEmail.jtp?type=nodeamp;node=4659307amp;i=1gt; To unsubscribe from Zend Framework Community, click here http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=634137code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4 . NAML http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namllt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml%3Egt; Hi Marco I've just a few problems to edit it You do not have access to this repo, would you like to fork it? what should I do ? -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304p4659307.html To start a new topic under Zend Framework, email ml-node+s634137n634138h98@.nabble To unsubscribe from Zend Framework Community, click herelt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codeamp;node=634137amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4gt; . NAMLlt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namlgt; I think may be done :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304p4659316.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
[fw-general] zend 2 custom library
Hi, in zf1 I'm used to have my own library like library App Zend I'm wondering if make sense in zend 2. Playing around with modules I realize you can share stuff like 'factories' = array( 'auth_service' = function ($sm) { return new \Zend\Authentication\AuthenticationService( $sm-get('auth_user_storage'), $sm-get('auth_user_adapater') ); }, auth_service will be available in all your modules. So what's do you think about it ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-custom-library-tp4659303.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
[fw-general] zend 2 EventManager reference
Hi, http://framework.zend.com/manual/2.1/en/modules/zend.event-manager.event-manager.html http://framework.zend.com/manual/2.1/en/modules/zend.event-manager.event-manager.html Examples Modifying Arguments new DateTime('now'); should be new \DateTime('now'); Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304.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
[fw-general] Re: zend 2 EventManager reference
Marco Pivetta wrote Heya! You can edit that yourself at https://github.com/zendframework/zf2-documentation/edit/master/docs/languages/en/modules/zend.event-manager.event-manager.rst Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 24 February 2013 21:33, whisher [via Zend Framework Community] ml-node+s634137n4659304h44@.nabble wrote: Hi, http://framework.zend.com/manual/2.1/en/modules/zend.event-manager.event-manager.html Examples Modifying Arguments new DateTime('now'); should be new \DateTime('now'); Bye -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304.html To start a new topic under Zend Framework, email ml-node+s634137n634138h98@.nabble To unsubscribe from Zend Framework Community, click herelt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codeamp;node=634137amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4gt; . NAMLlt;http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_vieweramp;id=instant_html%21nabble%3Aemail.namlamp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespaceamp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.namlgt; Hi Marco I've just a few problems to edit it You do not have access to this repo, would you like to fork it? what should I do ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-EventManager-reference-tp4659304p4659307.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
[fw-general] Re: Post/Redirect/Get Plugin don't take into account baseUrl
weierophinney wrote On Tue, Feb 12, 2013 at 10:14 AM, whisher lt; whisher06@ gt; wrote: Hi, I'm still just playing around (the play is quite over :) ) so I tried within an action controller to call prg method to redirect to a specific action like this return $this-prg('/auth/login',true); my current url is http://localhost/blog/public/auth/signup the redirect to http://localhost/auth/login I tried to set RewriteBase /blog/public/ but it doesn't what's the trouble ? Can you take a look at https://github.com/zendframework/ZendSkeletonApplication/blob/master/public/.htaccess and indicate if your htaccess matches it? In particular, the last 3 lines are intended to solve this very problem, and I'm curious if you're on an older version. -- Matthew Weier O'Phinney Project Lead| matthew@ Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend Yes,you are right it's a old version thanks -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Post-Redirect-Get-Plugin-don-t-take-into-account-baseUrl-tp4659133p4659299.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
[fw-general] zend 2 Authentication The supplied parameters to DbTable failed to produce a valid sql statement
Hi, I'm getting this error playing around with Authentication The supplied parameters to DbTable failed to produce a valid sql statement, please check table and column names for validity. the code global.php return array( 'db' = array( 'driver' = 'Pdo', 'dsn'= 'mysql:dbname=album;host=localhost', 'driver_options' = array( PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES \'UTF8\'' ), ), 'service_manager' = array( 'factories' = array( 'Zend\Db\Adapter\Adapter' = 'Zend\Db\Adapter\AdapterServiceFactory', ), ), ); Moule.php public function getServiceConfig() { return array( 'factories' = array( 'Auth\Model\User' = function($sm) { $tableGateway = $sm-get('UserTableGateway'); $table = new User($tableGateway); return $table; }, 'Auth' = function ($sm) { $dbAdapter = $sm-get('Zend\Db\Adapter\Adapter'); $authAdapter = new AuthAdapter($dbAdapter); $authAdapter -setTableName('user_auth') -setIdentityColumn('username') -setCredentialColumn('password'); return $authAdapter; }, 'UserTableGateway' = function ($sm) { $dbAdapter = $sm-get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new ResultSet(); $resultSetPrototype-setArrayObjectPrototype(new RegisterInputFilter()); return new TableGateway('user_auth', $dbAdapter, null, $resultSetPrototype); } ), ); } AuthController.php public function loginAction() { $sm = $this-getServiceLocator(); $authAdapter = $sm-get('Auth'); $form = new Login('frm-sign-in'); $form-get('submit')-setValue('Login'); $request = $this-getRequest(); if ($request-isPost()) { $filter = new LoginInputFilter(); $form-setInputFilter($filter-getInputFilter()); $form-setData($request-getPost()); if ($form-isValid()) { $filter-exchangeArray($form-getData()); $authAdapter -setIdentity($filter-username) -setCredential($filter-password); $result = $authAdapter-authenticate(); //if($result-isValid()){} \Zend\Debug\Debug::dump($result-isValid()); \Zend\Debug\Debug::dump($authAdapter-getResultRowObject(null,'password')); } } // \Zend\Debug\Debug::dump($this-getEvent()-getResult()); return array('form' = $form); } Can anyone point me out whare I'm wrong,please ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-Authentication-The-supplied-parameters-to-DbTable-failed-to-produce-a-valid-sql-statement-tp4659161.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
[fw-general] Re: zend 2 Authentication The supplied parameters to DbTable failed to produce a valid sql statement
ralphschindler wrote Are you using 2.1.1? This was an issue in 2.1.0: https://github.com/zendframework/zf2/issues/3623 -ralph On 2/14/13 7:12 AM, whisher wrote: List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend Yes, thanks for the point as soon as possible I'll update. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zend-2-Authentication-The-supplied-parameters-to-DbTable-failed-to-produce-a-valid-sql-statement-tp4659161p4659164.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
[fw-general] Post/Redirect/Get Plugin don't take into account baseUrl
Hi, I'm still just playing around (the play is quite over :) ) so I tried within an action controller to call prg method to redirect to a specific action like this return $this-prg('/auth/login',true); my current url is http://localhost/blog/public/auth/signup the redirect to http://localhost/auth/login I tried to set RewriteBase /blog/public/ but it doesn't what's the trouble ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Post-Redirect-Get-Plugin-don-t-take-into-account-baseUrl-tp4659133.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
[fw-general] ZF 2 - Translate Validation Error messages
Hi, I put in Application module public function onBootstrap(MvcEvent $e) { $translator=$e-getApplication()-getServiceManager()-get('translator'); $eventManager= $e-getApplication()-getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener-attach($eventManager); $application = $e-getApplication(); $translator-addTranslationFile( 'phpArray', 'vendor/zendframework/zendframework/resources/languages/Zend_Validate.php', 'default', 'de_DE' ); AbstractValidator::setDefaultTranslator($translator); // \Zend\Debug\Debug::dump($application); } then I enabled php5-intl but the form still keeping on message in english. What's the trouble ? Please :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF-2-Translate-Validation-Error-messages-tp4659134.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
[fw-general] Re: ZF 2 - Translate Validation Error messages
samsonasik wrote there is no languages/Zend_Validate.php in ZF2 resources. Zend_Validate.php is at the folder under it, for ex : under de folder. if you want to translate using ZF2 resources, try with : $translator-addTranslationFile( 'phpArray', './vendor/zendframework/zendframework/resources/languages/langfolderyouwant/Zend_Validate.php' ); Thanks just a lot it works fine :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF-2-Translate-Validation-Error-messages-tp4659134p4659136.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
[fw-general] The Module Class - Sample Usage of “loadModules.post” Event
Hi, http://framework.zend.com/manual/2.0/en/modules/zend.module-manager.module-class.html http://framework.zend.com/manual/2.0/en/modules/zend.module-manager.module-class.html may in the doc in place of public function modulesLoaded(Event $e) { // This method is called once all modules are loaded. $moduleManager = $e-getTarget(); $loadedModules = $moduleManager-getLoadedModules(); // To get the configuration from another module named 'FooModule' $config = $moduleManager-getModule('FooModule')-getConfig(); } it will be better public function modulesLoaded(Event $e) { // This method is called once all modules are loaded. $moduleManager = $e-getTarget(); $loadedModules = $moduleManager-getLoadedModules(); // To get the configuration from another module named 'FooModule' $config = $moduleManager-getModule('Foo)-getConfig(); } just half an hour to figure it out :) Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/The-Module-Class-Sample-Usage-of-loadModules-post-Event-tp4658948.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
[fw-general] Re: [zf2] Class Map Generator utility write path with //
weierophinney wrote On Sun, Jan 20, 2013 at 9:47 AM, whisher lt; whisher06@ gt; wrote: I've used the map generator utility successfully with this comand php /home/fb/public_html/gs/vendor/bin/classmap_generator.php -w -l /home/fb/public_html/gs/module/Album -o /home/fb/public_html/gs/module/Album/autoload_classmap.php // Generated by ZF2's ./bin/classmap_generator.php return array( 'Album\Module' = __DIR__ . '//Module.php', snip I'm wondring if it's all ok (my doubt is about the double //) I've never witnessed the additional slash occurring when I've run the utility; what version of ZF2 are you using? Also, to answer your question: it won't cause any issues. -- Matthew Weier O'Phinney Project Lead| matthew@ Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend I'm using the 2.0.6 version. Thanks for the explanation about the double slashes. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zf2-Class-Map-Generator-utility-write-path-with-tp4658798p4658817.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
[fw-general] Re: [zf2] Class Map Generator utility write path with //
Ralf Eggert wrote Hi, what happens if you move to the Album path first: cd /home/fb/public_html/gs/module/Album php /home/fb/public_html/gs/vendor/bin/classmap_generator.php Do you still encounter the double slash? Regards, Ralf -- List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend No, it works fine. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zf2-Class-Map-Generator-utility-write-path-with-tp4658798p4658818.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
[fw-general] Re: [ZF2] The EventManager Reference Guide ( lack of code :( )
weierophinney wrote -- whisher lt; whisher@ gt; wrote (on Monday, 05 November 2012, 01:49 PM -0800): so I'm trying to learn zf2 after Module Manager I'm on EventManager but I find this use Zend\Log\Factory as LogFactory; $log = LogFactory($someConfig); $foo = new Foo(); $foo-getEventManager()-attach('bar', function ($e) use ($log) { $event = $e-getName(); $target = get_class($e-getTarget()); $params = json_encode($e-getParams()); $log-info(sprintf( '%s called on %s, using params %s', $event, $target, $params )); }); It's frustrating for a apprentice I dont' see any LogFactory file in Zend\Log\Factory what's $someConfig ? Could take me more info, please? Can you indicate where you're seeing this example, please? It's clearly out-of-date with the current status of the Log component and should be updated... but I need to know where. However, regardless, the _theory_ behind its operation is still the same. The idea behind the example is to show how you can create a listener for an event, and the values available to the event; how the log instance is retrieved is irrelevant. Essentially: * Listeners are always passed an Event object ($e above) * The event object has accessors to get the event name ($e-getName(), the target object triggering the event ($e-getTarget()), and parameters provided to the event ($e-getParams()). The above example shows retrieving the event manager from a fictional Foo class, and attaching to its bar event. -- Matthew Weier O'Phinney Project Lead| matthew@ Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@.zend Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscribe@.zend Thanks a lot weierophinney for the explanation :) @Mohammad have just pointed the out-of-date link. Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-The-EventManager-Reference-Guide-lack-of-code-tp4657922p4657931.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
[fw-general] [ZF2] The EventManager Reference Guide ( lack of code :( )
Hi, so I'm trying to learn zf2 after Module Manager I'm on EventManager but I find this use Zend\Log\Factory as LogFactory; $log = LogFactory($someConfig); $foo = new Foo(); $foo-getEventManager()-attach('bar', function ($e) use ($log) { $event = $e-getName(); $target = get_class($e-getTarget()); $params = json_encode($e-getParams()); $log-info(sprintf( '%s called on %s, using params %s', $event, $target, $params )); }); It's frustrating for a apprentice I dont' see any LogFactory file in Zend\Log\Factory what's $someConfig ? Could take me more info, please ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-The-EventManager-Reference-Guide-lack-of-code-tp4657922.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
[fw-general] Re: autoloader example?
http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12 http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12 -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/autoloader-example-tp4657613p4657617.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
[fw-general] Re: zf2 Modules - Application is comparable to the old default ?
Thanks a lot buddies for the feedback. So you have to set a module at least with all the stuff there is in Application don't you ? The project should know how to manage i118n (language folder) error (404) layout -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zf2-Modules-Application-is-comparable-to-the-old-default-tp4657237p4657258.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
[fw-general] RE: pre-validating files in Zend_File_Transfer
Hi, take a look at http://phpmaster.com/zf-clamav/ http://phpmaster.com/zf-clamav/ may be it can help you -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/pre-validating-files-in-Zend-File-Transfer-tp4310451p4312859.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
[fw-general] Re: What is the recommended way of using Doctrine2 with ZF1?
http://www.zendcasts.com/category/screencasts/databases/doctrine-databases/ -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/What-is-the-recommended-way-of-using-Doctrine2-with-ZF1-tp4191896p4200524.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
[fw-general] Re: WURFL 1.3.1 autoloader trouble
I've unzipped wurfl-2.0.27.zip and getting rid of wurfl-config.php with this in the config.ini resources.useragent.storage.adapter = Session resources.useragent.wurflapi.wurfl_api_version = 1.1 resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH /../library/wurfl-php-1.3.1/WURFL/ resources.useragent.wurflapi.wurfl_config_array.wurfl.main-file = APPLICATION_PATH /../data/wurfl/wurfl.xml resources.useragent.wurflapi.wurfl_config_array.wurfl.patches = APPLICATION_PATH /../data/wurfl/web_browsers_patch.xml resources.useragent.wurflapi.wurfl_config_array.persistence.provider = file resources.useragent.wurflapi.wurfl_config_array.persistence.dir.dir = APPLICATION_PATH /../data/wurfl/cache/ I've in the cache folder like /cache /0 /0 /112cae9721bd46a6a1b13cd6cab1cc and it seems to work if I put $bootstrap = $this-getInvokeArg('bootstrap'); $userAgent = $bootstrap-getResource('useragent'); $width = $userAgent-getDevice()-getPhysicalScreenWidth(); var_dump($width); in my index controller I've got string '49' (length=2) but your feedback would be very appreciated :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/WURFL-1-3-1-autoloader-trouble-tp3823975p3824049.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
[fw-general] Zend_Console_Getopt manage if there no options
Hi, try { $opts = new Zend_Console_Getopt(array( 'id=i' = 'id option,required an integer parameter' )); $opts-parse(); echo $opts-id; } catch (Zend_Console_Getopt_Exception $e) { echo $e-getMessage(); echo $e-getUsageMessage(); exit(); } If I run this snippet above without parameter like ./myscript.php I'm waiting an exception instead the script fails without error. Is it the a feature or I miss something ? Thanks in advance Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Console-Getopt-manage-if-there-no-options-tp3651587p3651587.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
[fw-general] Re: Creating a container using a config object: add reset param
Razorblade wrote: Hi All, I've created breadcrumbs using an xml config object as explained here http://framework.zend.com/manual/en/zend.navigation.containers.html , and I want to add the 'reset' param for a page. How to add it? Thanks Sergio Hi, I'm not sure what you are looking for but try to have a look http://www.zendcasts.com/zend_navigation-dynamically-creating-a-menu-a-sitemap-and-breadcrumbs/2009/06/ http://www.zendcasts.com/zend_navigation-dynamically-creating-a-menu-a-sitemap-and-breadcrumbs/2009/06/ Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Creating-a-container-using-a-config-object-add-reset-param-tp3588464p3589400.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
[fw-general] Re: Send mail with multiple Cc
David Muir wrote: You can't be getting the same error because the SMTP transport will not throw the same exception. The only exception that the SMTP transport throws is '_prepareHeaders requires a registered Zend_Mail object'. Is that what you're getting? David $body = 'Hi all,Alan'; $mail = new Zend_Mail(); $mail-setFrom('x...@x.com', 'Alan'); $mail-addTo('xxx...@gmail.com', 'Alan'); $mail-addCc(array('human_readable1'='x...@b.com','human_readable2'='x...@e.com')); $mail-setSubject('Basketball practice this week'); $mail-setBodyText($body); $mail-send(); I got: Fatal error: Uncaught exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. ' in /public_html/library/Zend/Mail/Transport/Sendmail.php:137 Stack trace: #0 /public_html/library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail-gt;_sendMail() #1 /public_html/library/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract-gt;send(Object(Zend_Mail)) #2 /public_html/www/index.php(46): Zend_Mail-gt;send() #3 {main} thrown in /public_html/library/Zend/Mail/Transport/Sendmail.php on line 137br / -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Send-mail-with-multiple-Cc-tp3556120p3571400.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
[fw-general] Re: Send mail with multiple Cc
Linux debian lenny php PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 4 2010 03:25:57) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies by now I can't use SMTP transport :( I tried as well passing an array $mail-addCc(array('human_readable1'='x...@b.com','human_readable2'='x...@e.com')); but I'm getting the same error. David Muir wrote: What platform are you using? If you can't send via mail() you can also try using the SMTP transport. David -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Send-mail-with-multiple-Cc-tp3556120p3565909.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
[fw-general] Re: Send mail with multiple Cc
Thanks for the point but I'm getting the same error. David Muir wrote: Error means that php's mail() function failed. You need to set up PHP to use an MTA to use the Sendmail transport. Check your php.ini to see if it's set up, particularly sendmail_path. Should be something like: sendmail_path = /usr/sbin/sendmail -t -i Cheers, David -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Send-mail-with-multiple-Cc-tp3556120p3562733.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
[fw-general] Re: Send mail with multiple Cc
Fatal error: Uncaught exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. ' in /public_html/library/Zend/Mail/Transport/Sendmail.php:137 Stack trace: #0 /public_html/library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail-gt;_sendMail() #1 /public_html/library/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract-gt;send(Object(Zend_Mail)) #2 /public_html/www/index.php(47): Zend_Mail-gt;send() #3 {main} thrown in /public_html/library/Zend/Mail/Transport/Sendmail.php on line 137br / David Muir wrote: whisher wrote: Hi,is there a way to send an email with multiple Cc. With this snippet: $body = 'Hi all,Alan'; $mail = new Zend_Mail(); $mail-setFrom('x...@x.com', 'Alan'); $mail-addTo('xxx...@gmail.com', 'Alan'); $mail-addCc('x...@.com', 'Someone Else'); $mail-addCc('xx...@.com', 'Another Recipient'); $mail-setSubject('Basketball practice this week'); $mail-setBodyText($body); $mail-send(); I got a Fatal error. Bye. Ps I also tried passing an array but it doesn't work. Kind of pointless to ask how to fix an error without letting us know what the error is, isn't it? Cheers, David -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Send-mail-with-multiple-Cc-tp3556120p3560656.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
[fw-general] Re: Zend Search Lucene and CPU abuse
Razorblade wrote: Hi All, today I got my hosting suspended because of a process related with Zend_Search_Lucene. The only thing they told me is the stack trace of the process that caused the abuse, but I cannot recognize which was the request that caused the issue. So my question is a bit generic: if I have cpu usage problem with Zend_Search_Lucene, what could be a common error that I might have done speaking about query the index or add a document to the index? Thanks for all suggestions Sergio Hi, I think it could be caused because when the resultset includes more than 1024 rows (default) but usually the script throw an exception. I managed it with $currentResultSetLimit = Zend_Search_Lucene::getResultSetLimit(); Zend_Search_Lucene::setResultSetLimit($newLimit); Bye -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Search-Lucene-and-CPU-abuse-tp3324604p3326115.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Zend Form Element: prepend arbitrary HTML
Andrei Iarus wrote: Hello, I need to prepend some custom HTML code (an link +other things) to an element and find it difficult, because all exemples I've seen use a custom Zend_Form_Element (to create it by hand). Is there any SIMPLE way to add some HTML code after or before an element? If not, I find it stupid... simply because most developers need a standard decorator for that. What do you think about that? Hi, take a look at http://stackoverflow.com/questions/2566432/add-some-html-to-zend-forms -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-prepend-arbitrary-HTML-tp3312640p3313211.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: How to handle 404
or $this-_helper-viewRenderer-setNoRender(); $this-_helper-getHelper('layout')-disableLayout(); $this-getResponse() -setBody('HTTP/1.1 404 Not Found') -setRawHeader('HTTP/1.1 404 Not Found'); -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-handle-404-tp3297572p3298210.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Accessing Bootstrap within Session Save Handler class
Hi, If you have a _initDoctrine in your bootstrap you could store the connession in Zend_Registry::set('db',$dottrineConn); what about putting your class in a controller plugin ? Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Accessing-Bootstrap-within-Session-Save-Handler-class-tp3208482p3214721.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Acl with a custom route doesn't work.
Hi, In my application I've a acl plugin loaded by application.ini resources.frontController.plugins.Acl = W_Controller_Plugin_Acl this is its nitty-gritty of the plugin $this-addRole(new Zend_Acl_Role('admin')); //$this-_loadResources(); //$this-_loadUsersPermissions(); $this-addRole(new Zend_Acl_Role('user')); //load common resources $this-add(new Zend_Acl_Resource('default_index')); $this-add(new Zend_Acl_Resource('default_error')); $this-add(new Zend_Acl_Resource('default_auth')); $this-add(new Zend_Acl_Resource('default_user_index')); // set up the access rules everybody $this-allow(null, array('default_index', 'default_error','default_auth')); //grant the super admin access to everything $this-allow('admin'); Without route if I go to user/index as null role (not allowed) the script do the work (login) but if I put in the bootstrap a route like this protected function _initRoutes() { $this-bootstrap('frontController'); $front = $this-getResource('frontController'); $router = $front-getRouter(); $router-addRoute( 'user', new Zend_Controller_Router_Route( 'user/:username', array( 'controller' = 'user', 'action' = 'index' )) ); } I gain the access and I don't understand why :( Could you help me, please ? Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Acl-with-a-custom-route-doesn-t-work-tp3171768p3171768.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Acl with a custom route doesn't work.
$this-bootstrap('frontController'); $front = $this-getResource('frontController'); $router = $front-getRouter(); $router-addRoute( 'user', new Zend_Controller_Router_Route( 'user/:username', array( 'module' = 'default', 'controller' = 'user', 'action' = 'index' )) ); I forgot the module in the route :) now it works. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Acl-with-a-custom-route-doesn-t-work-tp3171768p3171780.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: json_encode / json_decode vs Zend_Json::encode / Zend_Json::decode
$memoryNativeStart = memory_get_peak_usage (true); $start = microtime( true ); $native = json_decode(json_encode( $data )); $memoryNative = memory_get_peak_usage (true) - $memoryNativeStart; $jsonNativeTime = microtime( true ) - $start; $msgNative = 'Native php '; $msgNative .= 'time '.$jsonNativeTime.' memory '.$memoryNative.' '; echo $msgNative; sleep(3); $memoryZendStart = memory_get_peak_usage (true); $start = microtime( true ); $zend = Zend_Json::decode(Zend_Json::encode( $data )); $memoryZend = memory_get_peak_usage (true) - $memoryZendStart; $jsonZendTime = microtime( true ) - $start; $msgZend = 'Zend '; $msgZend .= 'time '.$jsonZendTime.' memory '.$memoryZend; echo $msgZend; inside data there is about 130,000 records (with a result set) I get Native php time 2.24236011505 memory 158072832 Zend time 3.50552582741 memory 109051904 -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/json-encode-json-decode-vs-Zend-Json-encode-Zend-Json-decode-tp3080647p3082295.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: json_encode / json_decode vs Zend_Json::encode / Zend_Json::decode
Thanks for the reply. [of 100k+ items, you're likely doing something wrong anyways] so I have to do a heavy query I can't use limit and you know I've to do the query :) I avoid memory leak getting the cursor like that $data = array(); $db = Zend_Registry::get('db'); $stmt = $db-query($query); while ($row = $stmt-fetch()) { $data[] = $row; } // $content = Zend_Json::encode($data); I don't think to do someting wrong imho if you know a better approach well I'll be very pleased to know it :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/json-encode-json-decode-vs-Zend-Json-encode-Zend-Json-decode-tp3080647p3082611.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Typo in zend.http.user-agent.html
Hi, To point out a typo in http://www.framework.zend.com/manual/en/zend.http.user-agent.html http://www.framework.zend.com/manual/en/zend.http.user-agent.html It's chmod -R o+rwX data/worful/cache It should be chmod -R o+rwX data/wurfl/cache Bye. Well done folks ! -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Typo-in-zend-http-user-agent-html-tp3028824p3028824.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] iframe tag embedded in a view (html5)
Hi, I'm trying to embedded a youtube video in a view using html5. So following http://techie-buzz.com/youtube/html5-embed-code-youtube-videos.html I put in the view a iframe tag but I've got invalid controller specified (%E2%80%9Dhttp:) Stack trace: Request Parameters: array ( 'controller' = '%E2%80%9Dhttp:', '' = 'www.youtube.com', 'embed' = 'JW5meKfy3fY”', 'action' = 'index', 'module' = 'default', ) and I've not idea how can work it out :( Could you help me ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/iframe-tag-embedded-in-a-view-html5-tp3027686p3027686.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Application setOptions what's $options['config']
Hi, I'm just peeping into Zend_Application and I don't figure out what sort of information go into $options['config']. if (!empty($options['config'])) { if (is_array($options['config'])) { $_options = array(); foreach ($options['config'] as $tmp) { $_options = $this-mergeOptions($_options, $this-_loadConfig($tmp)); } $options = $this-mergeOptions($_options, $options); } else { $options = $this-mergeOptions($this-_loadConfig($options['config']), $options); } } Could you enlighten me, please ? Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Application-setOptions-what-s-options-config-tp2227164p2227164.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Session Db trouble with ajax request without event handleri
It works with a table like CREATE TABLE `tn_session` ( `id` char(32), `modified` int, `lifetime` int, `data` text, PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; and in the bootstrap protected function _initDbSession() { $config = array( 'name' = 'tn_session', 'primary'= 'id', 'modifiedColumn' = 'modified', 'dataColumn' = 'data', 'lifetimeColumn' = 'lifetime' ); Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)); } Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Session-Db-trouble-with-ajax-request-tp2073591p2075594.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Session Db trouble with ajax request without event handleri
Yes, I agree with you but the script works fine with session in file so I'm at my wits end :( Thanks just a lot for your help. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Session-Db-trouble-with-ajax-request-tp2073591p2076218.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Session Db trouble with ajax request without event handleri
Hi, Sorry to bother you but I've a very strange behaviour using session Db. If I make a ajax request without a event handler the sessions Db doesn't work (if I'm login the script log me out). while if I use the standard session (file) the script works fine. $(function() { //$(#dataWrapper).tablesorter(); tvnVideoApp.resetServerPaginator(); /* with the line below if I've set up the session Db the script doesn't work */ tvnVideoApp.sendRequest(1); $('#pagination ul li a').click(function(){ /* No problem with this */ tvnVideoApp.sendRequest(2); return false; }); }); Could you help me,please ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Session-Db-trouble-with-ajax-request-without-event-handleri-tp2073591p2073591.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Session Db trouble with ajax request without event handleri
Yes, I'm using Jquery. Like tvnVideoApp.sendRequest = function(page) { $.ajax({ type: POST, timeout:3000, url: sBasePath + '/admin/video/listxhr' , cache: false, dataType: 'html', data: {'page':page} , success: function(data){ $(#dataWrapper tbody).html(data); alert(data); }, error:function(xhr, str, er){ alert('error'); return; } }); } Thanks for the quick reply :) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Session-Db-trouble-with-ajax-request-tp2073591p2073605.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Form hash troubles with a prod server
Hi, Sorry to bother you. I've just a lot of troubles with the form hash in a prod server (it work right in localhost) Could you give me any idea on what I've to check out ? I've the same problem both with file session and db session. The prodution server run FastCgi. Bye. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Form-hash-troubles-with-a-prod-server-tp2041465p2041465.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend Session Db garbage collector
Hi, Sorry to disturb you. I set up my first project with Zend Session Db and after the logout action I just see the row in the db. Shall I set up a garbage collector method ? I'd like to have in the Db only the active session. Bye. -- View this message in context: http://n4.nabble.com/Zend-Session-Db-garbage-collector-tp2018595p2018595.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Zend Session Db garbage collector
public function logoutAction() { if(!$this-auth-hasIdentity()){ $this-_helper-redirector('index', 'index', 'default'); } $this-auth-clearIdentity(); Zend_Session::namespaceUnset(md5(App_Controller_Main::SESSION_ADMIN_NAME)); Zend_Session::destroy(); $this-_helper-redirector('login', 'index', 'admin'); } Thans it works fine. Bye. -- View this message in context: http://n4.nabble.com/Zend-Session-Db-garbage-collector-tp2018595p2019735.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend form captcha element decorator problem
Hi, I’ve just a lot of troubles with a captcha element. The element is put to the top and the description to the end I don’t know which way to turn. Here the form class Form_Test extends Zend_Form { public function init() { $this-setMethod('post'); $this-setAttrib('enctype', 'application/x-www-form-urlencoded'); $this-setAttrib('id','frmUserRegister'); $this-setAttrib('class',''); $translator = $this-getTranslator(); // Email $this-addElement('text', 'email', array( 'required' = true, 'maxlength' = 255, 'title' = $translator-translate('Your email'), 'label' = 'Email :', 'filters'= array('StringTrim'), 'validators' = array( array('EmailAddress',true), array('Db_NoRecordExists', false, array('table' = 'tn_user', 'field' = 'email'))) )); // Password $this-addElement('password', 'password', array( 'required' = true, 'maxlength' = 30, 'title' = $translator-translate('Choose your password'), 'label' = 'Password :', 'filters'= array('StringTrim'), 'validators' = array( array('stringLength',true, array(3, 30))) )); //Re-Password $this-addElement('password', 'repassword', array( 'required' = true, 'maxlength' = 30, 'title' = $translator-translate('Re-type your password'), 'label' = 'Re-type password :', 'filters'= array('StringTrim'), 'validators' = array( array('stringLength',true, array(3, 30))) )); // Firstname $this-addElement('text', 'first_name', array( 'required' = true, 'maxlength' = 30, 'title' = $translator-translate('Your first name'), 'label' = 'First name :', 'filters'= array('StringTrim','StringtoLower','StripTags'), 'validators' = array( array('stringLength',true, array(3, 30))) )); // Lastname $this-addElement('text', 'last_name', array( 'required' = true, 'maxlength' = 30, 'title' = $translator-translate('Your last name'), 'label' = 'Last name :', 'filters'= array('StringTrim','StringtoLower','StripTags'), 'validators' = array( array('stringLength',true, array(3, 30))) )); //Captcha $this-addElement('captcha', 'captchaRegister', array( 'required'= true, 'label' = 'Please enter the 5 letters displayed aside:', 'title' = $translator-translate('Please enter the 5 letters displayed above'), 'captcha'= array( 'captcha' = 'Figlet', 'wordLen' = 5, 'timeout' = 300 ) )); // Csrf $this-addElement('hash', 'userRegisterHash', array( 'ignore' = true, )); // Submit $this-addElement('submit', 'userRegisterSubmit', array( 'ignore' = true, 'label'= 'Sign up', )); $this-setElementDecorators(array( 'ViewHelper', array(array('data' = 'HtmlTag'), array('tag' ='td', 'class'= 'element')), array('Label', array('tag' = 'td')), array(array('row' = 'HtmlTag'), array('tag' = 'tr')) )); $captcha = $this-getElement('captchaRegister'); $captcha-setDecorators(array( array(array('data' = 'HtmlTag'), array('tag' ='td', 'class'= 'element')), array('Label', array('tag' = 'td')), array(array('row' = 'HtmlTag'), array('tag' = 'tr')) )); $submit = $this-getElement('userRegisterSubmit'); $submit-setDecorators(array('ViewHelper', array(array('data' = 'HtmlTag'), array('tag' ='td', 'class'= 'element')), array(array('emptyrow' = 'HtmlTag'), array('tag' ='td', 'class'= 'element', 'placement' = 'PREPEND')), array(array('row' = 'HtmlTag'), array('tag' = 'tr')) )); $this-setDecorators(array( 'FormElements', array('HtmlTag', array('tag' = 'table')), 'Form' )); } } -- View this message in context: http://n4.nabble.com/Zend-form-captcha-element-decorator-problem-tp2015547p2015547.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: How do you translate javascript files?
umpirsky wrote: Hi. I'm thinking about best way to translate js files. In my previous project, I use to have server side generated js file for translation, looked like var STR1 = ?= $this-translate('str.') ?; var STR2 = ?= $this-translate('str2.') ?; // ... But is this really required, maybe writing manual this files and then just include one depending on lang settings, for better performances, but, this one can be cached also if you mess with headers a bit. How do you handle this? Regards, Sasa Stamenkovic. Hi, script type=text/javascript src=?php echo $this-baseUrl('myfule-'.$this-lang.'.js'); ?/script but making so you can't exploit ?= $this-translate('str.') ?; so you have double translation so I think a better way is do a think like this script type=text/javascript src=?php echo $this-baseUrl('myfule-'.$this-lang.'.php'); ?/script with the right header. Bye. -- View this message in context: http://n4.nabble.com/How-do-you-translate-javascript-files-tp1748879p1751159.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Form_Element_Hash with two random server
Hi, Hi, I'm debugging a script hosted by two server. You can land on serverOne or ServerTwo randomly. I'm getting troubles from the script so the first thing I thaught of was Zend_Form_Element_Hash. Could me tell me your opinion about it, please ? Bye -- View this message in context: http://n4.nabble.com/Zend-Form-Element-Hash-with-two-random-server-tp1593996p1593996.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: How to log an exception throwed inside a controller?
Hi, Try with thing like this in your ErrorController $dir = Zend_Registry::get('dir'); $log = new Zend_Log( new Zend_Log_Writer_Stream( $dir-log.'applicationException.log' ) ); $log-debug($errors-exception-getMessage() . \n . $errors-exception-getTraceAsString()); Bye. -- View this message in context: http://n4.nabble.com/How-to-log-an-exception-throwed-inside-a-controller-tp1572369p1573021.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Validate::is Int more than 10 digits return false :(
Hi, Sorry to disturb. I think there something wrong here var_dump(Zend_Validate::is(1234567890, 'Int'));//true var_dump(Zend_Validate::is(12345678901, 'Int'));//false Bye. -- View this message in context: http://n4.nabble.com/Zend-Validate-is-Int-more-than-10-digits-return-false-tp1570772p1570772.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Localization Format date helper.
Hi, I need a formatDate helper to use in the views but I'm in trouble on which way to turn. To sum up in my bootstrap I've got $zl = new Zend_Locale(); $zl-setLocale($locale); Zend_Registry::set('Zend_Locale', $zl); $currency = new Zend_Currency($locale); Zend_Registry::set('Zend_Currency', $currency); Zend_Registry::set('Zend_Translate', $translate); when I insert a date $date = new Zend_Date(); // Output of the current timestamp $data['registration_datetime'] = $date-toString('-MM-dd HH:mm:ss'); but to show a date in the view I'm stuck on (I mean for the code inside the helper) I tried with $locale = new Zend_Locale('de_AT'); $date = Zend_Locale_Format::getDate('13.04.2006', array('date_format' = Zend_Locale_Format::STANDARD, 'locale' = $locale) ); print_r ($date); it's the example and it works :) but if I try $locale = new Zend_Locale('en_US'); $date = Zend_Locale_Format::getDate('13.04.2006', array('date_format' = Zend_Locale_Format::STANDARD, 'locale' = $locale) ); print_r ($date); I get a Zend_Locale_Exception the method need the right format depend on local like $locale = new Zend_Locale('en_US'); $date = Zend_Locale_Format::getDate('04.13.2006', array('date_format' = Zend_Locale_Format::STANDARD, 'locale' = $locale) ); print_r ($date); May be I miss something ? can you help me, please ? Bye The last doubt but the static method return an array same trouble for the output -- View this message in context: http://n4.nabble.com/Localization-Format-date-helper-tp1555937p1555937.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Localization Format date helper.
This workish $locale = new Zend_Locale('en_US'); $date = new Zend_Date('2010-02-15 10:53:26',Zend_Locale_Format::getDateFormat($locale) , $locale); echo $date; but the output isn't very nice :( -- View this message in context: http://n4.nabble.com/Localization-Format-date-helper-tp1555937p1555995.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Localization Format date helper.
Thanks Thomas for the help. Sorry but I don't see your point I just use toString() $dateString = $date-toString(Zend_Date::DATETIME_SHORT); -- View this message in context: http://n4.nabble.com/Localization-Format-date-helper-tp1555937p1556584.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] There is no way to customize the validator messages?
Hi. You can put your value using Zend_Translate for instance: $translate = new Zend_Translate('array', APPLICATION_PATH . '/configs/lang/'. $locale . '.php' , $lang); in my it_IT.php return array( /* VALIDATORS */ Zend_Validate_NotEmpty::IS_EMPTY = 'Il campo è obbligatorio e non può essere vuoto'/*Value is required and can\'t be empty*/, etct etc etc You can find the keys at http://framework.zend.com/manual/en/zend.validate.messages.html http://framework.zend.com/manual/en/zend.validate.messages.html Chou Ken wrote: There is no way to customize the validator messages? http://framework.zend.com/manual/en/zend.file.transfer.validators.html the doc said:Upload: This validator is internal. It checks if an upload has resulted in an error. You must not set it, as it's automatically set by Zend_File_Transfer itself. So you do not use this validator directly. You should only know that it exists. 青青子衿,悠悠我心 -- View this message in context: http://old.nabble.com/There-is-no-way-to-customize-the-validator-messages--tp26369321p26369713.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] How to get session namespace value
Thanks guys for your help ;) -- View this message in context: http://www.nabble.com/How-to-get-session-namespace-value-tp25413546p25421992.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] How to get session namespace value
Hi. In the registerAction I set my namespace $userRegisterSession = new Zend_Session_Namespace('userRegister'); $userRegisterSession-user = $data; return $this-_helper-redirector('onregistersuccess');; Than I need to retrieve the data so public function onregistersuccessAction() { if(!Zend_Session::namespaceIsset('userRegister')){ return $this-_helper-redirector('index'); } $this-view-headTitle($this-translator-translate('user_Register_HeadTitle_onsuccess')); $userRegisterSession = new Zend_Session_Namespace('userRegister'); var_dump($userRegisterSession-getIterator()); } As Zend_Session::_namespaceGet('userRegister') is deprecated, I don't find an other way.( Indeed, it's a very ugly way) I figure out there will be a more smart way. Can you give me an example ? Thanks in advance Bye -- View this message in context: http://www.nabble.com/How-to-get-session-namespace-value-tp25413546p25413546.html Sent from the Zend Framework mailing list archive at Nabble.com.