zend-framework3

is it possible to install doctrine orm module with ZF3 skeleton app?

北城以北 提交于 2019-12-12 04:23:53
问题 My knowledge of php composer is no more than basic, but... I've downloaded and installed the Zend Framework 3.0.0dev MVC skeleton app and wanted to find out if I could install the Doctrine ORM module along with it. composer require doctrine/doctrine-orm-module complains about Problem 1 - Installation request for doctrine/doctrine-orm-module ^0.10.0 -> satisfiable by doctrine/doctrine-orm-module[0.10.0]. - doctrine/doctrine-orm-module 0.10.0 requires zendframework/zend-mvc ~2.3 -> satisfiable

use zend framework 2/3 component's outside zf app

[亡魂溺海] 提交于 2019-12-12 03:39:57
问题 I am trying to use some zend framework components outside of zend framework but I am unable to do so. Here is my composer file. { "require": { "zendframework/zend-authentication": "^2.5.3" }, "autoload": { "psr-4": { "Zend\\Authentication\\": "" } } } I was able to run composer update and install which has generated the autoload.php. But when I try to use a the component I get "Fatal error: Class 'Zend\Authentication\Storage\Session' not found" $session = new \Zend\Authentication\Storage

Zend ServiceManager using setter injection

风格不统一 提交于 2019-12-11 17:17:23
问题 in symfony i can use the setter injection for services via call option (https://symfony.com/doc/current/service_container/calls.html) The example from the symfony documentation: class MessageGenerator { private $logger; public function setLogger(LoggerInterface $logger) { $this->logger = $logger; } // ... } service.yml services: App\Service\MessageGenerator: # ... calls: - method: setLogger arguments: - '@logger' I need this behaviour for my zend project. i want to inject a InputFilter into

Zend Framework 3 error handling

安稳与你 提交于 2019-12-11 16:49:49
问题 I'm trying to handle error from my CheckAccess plugin within ZF3. Plugin is attached like this in module's onBootstrap method class Module { public function onBootstrap() { ... $em->attach(MvcEvent::EVENT_DISPATCH, new Plugin\CheckAccess($sm), 2); ... } } Here what i'm doing exactly inside the plugin's __invoke() when i need to redirect not logged-in user from some page to login page: if ($user->isGuest()) { $rh = new RouteHelper($e->getRouter(), $e->getRouteMatch()); $url = $rh->frontend(

Using doctrine OneToOne relation with condition in zf3

a 夏天 提交于 2019-12-11 16:22:44
问题 I want to use Doctrine's relation OneToOne in entity User. Eg. User has 2 exams - first and corrective. All exams are in one table but with flag is_corrective . How can I use OneToOne relation for this two types of exams for one user? 回答1: You can use Single Table Inheritance for this. 1)Create entity FirstExam : use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="exam_table_name") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="is_corrective", type=

Catching Exceptions in Zend Framework 3

独自空忆成欢 提交于 2019-12-11 15:43:01
问题 I use the ZF3 skeletion application. I wonder where I am supposed to catch exceptions globally. Example: Right now, if I access an invalid route (mysite.com/invalid-route), the application reports an uncaught expection and HTTP response code 200 Fatal error: Uncaught Zend\View\Exception\RuntimeException: No RouteMatch instance provided I would expect the build-in 404 error page to be triggered. What am I missing? Can someone point me to the right direction? The exception is logged properly

Zendframework 3 - Can't get entityManager on Application/Module

浪尽此生 提交于 2019-12-11 15:33:45
问题 I use Zendframework 3 and I have followed the tutorial for User authentication. In this project I'm able to connect to my database using entityManager. Then I created another project and copied the required code to make ORM work but I'm not able to retrieve information. I have read my code 1000 time, no error in log, every factory is correctly mapped. Here's my configuration: composer.json { "name": "zendframework/skeleton-application", "description": "Skeleton Application for Zend Framework

ZF3 MVC Zend\Authentication as a Service Factory

我的梦境 提交于 2019-12-11 06:35:55
问题 I'm trying to adapt my ZF2 User module to ZF3 MVC. It has an authentication service manager that is called in the onBootsrap function inside the Module class for every request (i.e. page loading) to check if the user is authenticated. As serviceLocator and ServiceAware are not available anymore I'm trying to create an AuthenticationServiceFactory but I do not succeed yet. Would you have any ideas on what I'm doing wrong and how I could do it with ZF3 ? Here is a simplified version of my

ZF3 - Populate Select from Database

大城市里の小女人 提交于 2019-12-11 05:03:32
问题 I'm doing some work using Zend Framework 3 and I need to display in the form a select populated with options comming from the database. I am using SQL Abstraction used in the Zend Tutorial blog part. The idea is to show the form that is already build and add a simple select with data returned from a different table, all the form is working using the users table (which has the country id) and i would like to link that id to the correct table and then show all the countries in the select..

How get a valid JSON output from the response in Zend Framework 3?

家住魔仙堡 提交于 2019-12-11 04:46:31
问题 I'm writing a client for an API... use Zend\Http\Client; use Zend\Http\Request; use Zend\Json\Json; ... $request = new Request(); $request->getHeaders()->addHeaders([ 'Accept-Charset' => 'UTF-8', 'Accept' => 'application/hal+json', 'Content-Type' => 'application/hal+json; charset=UTF-8', ]); $apiAddress = 'http://my.project.tld/categories'; $request->setUri($apiAddress); $request->setMethod('GET'); $client = new Client(); $response = $client->dispatch($request); $data = $response->getContent(