zend-framework3

Dependency management in Zend Framework 2 MVC applications

陌路散爱 提交于 2019-12-19 09:15:36
问题 As the ServiceLocatorAwareInterface will likely be removed from the AbstractController in ZF3, dependencies should instead be passed via the constructor or via setter methods. With this in mind, consider the use case of a user or site controller with actions such as register, activate account, login, logout, etc. At a minimum, this would require a UserService and 2 forms. Add a few more related actions (remote authentication, linking of accounts, etc.) and you end up with 4 or 5 forms.

Deprecated: Retrieve service locator in functional system - ZF2

大憨熊 提交于 2019-12-18 15:55:11
问题 I'm developing a ZF2 system and it was working very well, but after I clone the repository in other computer this deprecated error has appeared: You are retrieving the service locator from within the class Module\Controller\Controller. Please be aware that ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. You will need to update your class to accept all dependencies at creation, either via constructor arguments or

Doctrine2 Update Caused AnnotationRegistry registerLoader Error in Zend Framework 3

时光总嘲笑我的痴心妄想 提交于 2019-12-18 14:57:07
问题 I'm working on a CMS based on Zend Framework 3.0 to manage a DB I with Doctrine. What is my problem when managing packages with composer? Recently, I updated all the packages to newest versions and sent it to server, nothing was changed in other files. After the update my site displayed the following error: Fatal error: Uncaught TypeError: Return value of Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() must be an instance of Doctrine\Common\Annotations\void, none returned in

ZF3/2 - how to catch an exception thrown within EVENT_DISPATCH listener?

…衆ロ難τιáo~ 提交于 2019-12-14 04:25:33
问题 Is there any way I can serve an exception thrown within EVENT_DISPATCH listener? class Module { public function onBootstrap(EventInterface $event) { $application = $event->getTarget(); $eventManager = $application->getEventManager(); $eventManager->attach(MvcEvent::EVENT_DISPATCH, function(MvcEvent $event) { throw new ForbiddenException("403 - Fobidden"); }); } } I have a common way of serving ForbiddenException like setting 403, returning JSON, etc... All of the logic is attached to MvcEvent

How to add paging in Doctrine Zend Framework 3

你说的曾经没有我的故事 提交于 2019-12-14 03:34:31
问题 I've already added paginator.phtml file and I have added some code in controller $adapter = new DoctrineAdapter(new ORMPaginator( $logList , false)); $paginator = new Paginator($adapter); $paginator->setDefaultItemCountPerPage(10); $paginator->setCurrentPageNumber(1); return new ViewModel(['logList'=>$logList ,'form'=>$form,'posts' => $paginator]); On the view page I'm using this code: $this->paginationControl($posts, 'Sliding', 'ripple-site/partial/paginator', ['route' => 'ripplesite'] );

Apache Virtual Host Setup on Centos for Zend Framework 3

风流意气都作罢 提交于 2019-12-13 20:39:50
问题 I am newbie to zf3 and have extracted the ZF3 Skeleton Application from GitHub into location /var/www/html/zf2-tutorial and had installed successfully to get the zf3 home page from URL https://xxx.xxx.xx.xx/zf2-tutorial/public While going through the tutorial i found i have to set up a virtual host to access the site like zf2-tutorial.localhost so i followed the steps and making a zf2-tutorial.conf file under /etc/httpd/conf.d folder . zf2-tutorial.conf <VirtualHost *:80> ServerName https:/

How to apply InputFilter validators to fieldset elements in ZF3

独自空忆成欢 提交于 2019-12-13 03:49:59
问题 I had a form that had two fields. An InputFilter with validators was applied to it. It was working fine. Then I moved the fields to a fieldset and added the fieldset to the form. Now the assignment validators to the fields is not present. The validator objects isValid method is not triggered at all. So how to apply the InputFilter validators to fields in a fieldset? Here you are the classes: Text class Validator namespace Application\Validator; use Zend\Validator\StringLength; use Zend

zf3 skeleton application not working when change module.config.php of Application module

一曲冷凌霜 提交于 2019-12-13 03:26:02
问题 zf3 not work well when change route of Appliation module download a zf3 skeleton application ,change route of zf3 'router' => [ 'routes' => [ 'home' => [ 'type' => Literal::class, 'options' => [ 'route' => '/', 'defaults' => [ 'controller' => Controller\IndexController::class, 'action' => 'index', ], ], ], 'application' => [ 'type' => Segment::class, 'options' => [ 'route' => '/application[/:action]', 'defaults' => [ 'controller' => Controller\IndexController::class, 'action' => 'index', ], ]

Module cannot be initialized zf3 already searched internet

纵然是瞬间 提交于 2019-12-12 17:26:48
问题 I'm receiving the following error in a Zend Framework 3 Application : Fatal error: Uncaught Zend\ModuleManager\Exception\RuntimeException: Module (Serve) could not be initialized. I'm aware that there is some answers however none seem to point to zf3 and ive already scanned them without answer. I cannot seem to find an answer through research. Is it possible that my application is not loading modules? I have modified the application config just a tad so it might just not be loading the module

ZF3 redirection after ACL authorization failed

旧城冷巷雨未停 提交于 2019-12-12 11:26:36
问题 I have a new ZF3 application with ACL. Now I need, in case of unauthorized access, to redirect to an error page (403 for example). I think the best way is to fire an event, then catch it, but I failed... All is in my User module, in Module.php (extracts): namespace User; use Zend\Mvc\MvcEvent; use Zend\Permissions\Acl\Acl; use Zend\Stdlib\Response ; use Zend\View\Model\ViewModel; [...] class Module implements ConfigProviderInterface { [...] public function onBootstrap(MvcEvent $e) { // Set