zend-framework2

Zend framework 2 Skeleton App FATAL error

给你一囗甜甜゛ 提交于 2020-01-07 05:51:40
问题 I've installed skeleton app via composer and when pointing the browser to the public folder with virtual host I get the error: Fatal error: Uncaught exception 'Zend\Loader\Exception\InvalidArgumentException' with message 'Autoloader class Zend\Loader\StandardAutoloader must implement Zend\Loader\SplAutoloader' in /var/www/vhosts/ddns.net/subdomains/gameotic/vendor/zendframework/zendframework/library/Zend/Loader/AutoloaderFactory.php on line 91 Zend\Loader\Exception\InvalidArgumentException:

Zend Framework2 How to access a variable in my Service

孤街浪徒 提交于 2020-01-07 05:21:08
问题 I am creating my first Zend Framework2 Project. My page offers the option to create adverts. I now want to offer the option to bookmark an advert. What needs to be done is that when you are on the page of the advert, the site will check if you are logged in and if you are it will check if the advert is already bookmarked and display the message otherwise it will offer you a link to "add the advert to your bookmarks". This link will also be shown when you are not logged in and if you click on

ZF2 form validation (isValid) behaviour / error messages handling

感情迁移 提交于 2020-01-07 03:21:41
问题 I'm quite confused about what the function isValid actually does, can anyone help me to understand? Here a function from the ZF album tutorial: public function addAction() { $form = new AlbumForm(); $form->get('submit')->setValue('Add'); $request = $this->getRequest(); if ($request->isPost()) { $album = new Album(); $form->setInputFilter($album->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $album->exchangeArray($form->getData()); $this->getAlbumTable()-

How to make zf2 output errors with simple formatting?

巧了我就是萌 提交于 2020-01-07 02:21:33
问题 I am newbie with zf2 framework. For example, now I get this error: Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (ZfcUserOverride) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189 Stack trace: #0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager-

How to make zf2 output errors with simple formatting?

早过忘川 提交于 2020-01-07 02:21:13
问题 I am newbie with zf2 framework. For example, now I get this error: Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (ZfcUserOverride) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189 Stack trace: #0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager-

How to (correctly) extend ScnSocialAuth\Authentication\Adapter\HybridAuth::authenticate() method?

╄→гoц情女王★ 提交于 2020-01-06 15:15:06
问题 I'm using ScnSocialAuth ZF2 module to enable social media authentication in my project. As it uses ZfcUser as one of its dependencies, two DB tables are created/used by default: CREATE TABLE `user` ( `user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `username` VARCHAR(255) DEFAULT NULL UNIQUE, `email` VARCHAR(255) DEFAULT NULL UNIQUE, `display_name` VARCHAR(50) DEFAULT NULL, `password` VARCHAR(128) NOT NULL, `state` SMALLINT UNSIGNED ) ENGINE=InnoDB CHARSET="utf8"; and CREATE TABLE

Zend 2 - Default InArray Validator of Select Element gets lost

天大地大妈咪最大 提交于 2020-01-06 15:10:01
问题 I have an issue when adding a filter to my select elements in Zend 2.2. When creating a select element, a default validator is added to this element: This element adds an InArray validator to its input filter specification in order to validate on the server if the selected value belongs to the values. This works fine until I add a custom filter to that element: $filter = new Input('element_name'); $filter->setRequired(true); $this->add($filter); This Zend\InputFilter\Input is added to a Zend

Zend-framework Query TOP

血红的双手。 提交于 2020-01-06 13:08:53
问题 Hello i try generate a query in Zend 2 just like this select top 10 * from mensaje where idUsuario = 11 order by fechaAltaMensaje DESC i try use this $select = $sql->select(); $select->from('mensaje'); $select->where('idUsuario = '.$idUser.' order by fechaAltaMensaje DESC'); $select->limit(5); but don't work 回答1: You are missing some details in your code in order for it to work, please see below. $adapter = $this->tableGateway->getAdapter();//use Zend\Db\TableGateway\TableGateway; $sql = new

ZF2 Autoloader: Use factory for base class on extended classes as well

纵饮孤独 提交于 2020-01-06 03:59:10
问题 If I wanted to use the same factory for any class that extended my base class, would I want to turn the base class factory into a named function, or is there a better way to do this? $serviceManager => array( 'factories' => array( 'someBaseClass' => function($thisServiceManager) { $db = $thisServiceManager->get('db'); $thisBaseClass = new \myNamespace\thisBaseClass($db); return $thisBaseClass; }, ), ); EDIT Further to the answer I accepted, here's the code I've tested that works. Class File

prevent merging two module config in Zend Framework 2

送分小仙女□ 提交于 2020-01-06 03:02:09
问题 I have two module in my ZF2 application, both module have different configuration for themself, and both module have different Module.php with different configruation inside it. I have a login process for Admin, which is defined in Module.php like below: in onBootstrap funtion: public function onBootstrap($e) { $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) { $controller = $e->getTarget();