zend-framework2

Safari doesn't show duration of mp3 served from php correctly

…衆ロ難τιáo~ 提交于 2019-12-04 23:57:31
Original question I'm serving an mp3 file from a ZF2 controller action. This works fine in all browsers except for Safari on OS X and iPhone/iPad. The audio plays, but the duration is just displayed as NaN:NaN, whereas in every other browser the correct duration is being displayed. I went over all the threads on SO talking about the same problem and it seems like it has something to do with the response headers and the Content-Range and Accept-Ranges headers in particular. I've tried all the different combinations but still to no avail - Safari still refuses to display the duration correctly.

The target-entity “some entity” cannot be found

给你一囗甜甜゛ 提交于 2019-12-04 23:45:20
i am using ZF2 with doctrine i am getting this error. The target-entity Entity\User cannot be found in 'Subject\Entity\Subject#user'. Here is the snippet to my code. <?php namespace Subject\Entity; use Doctrine\ORM\Mapping as ORM; use Zend\InputFilter\InputFilter; use Zend\InputFilter\Factory as InputFactory; use Zend\InputFilter\InputFilterAwareInterface; use Zend\InputFilter\InputFilterInterface; /** * @ORM\Entity * @ORM\Table(name="subject") * @property string $subjectname * @property int $user_id * @property int $id */ class Subject implements InputFilterAwareInterface { protected

Zend 2: How to throw a 404 error from controller

限于喜欢 提交于 2019-12-04 22:54:36
I want to throw a '404 Page not found' error from my controller. How can I do that? I use Zend Framework 2 not 1. Just try with: $this->getResponse()->setStatusCode(404); return; in your controller's action method. class IndexController extends AbstractActionController { public function previewAction () { return $this->notFoundAction (); } } In the correct ZF2 setup you should already have your 404 view, then in your controller action just use the following and the 404 is automatically handled for you: if($notTheCorrectSlugMatchOrWhatEver){ return $this->notFoundAction(); } 来源: https:/

Zend Framework 2: Zend_Navigation

依然范特西╮ 提交于 2019-12-04 22:00:35
I am just wondering what would be the best way, to use Zend_Navigation in Zend Framework2. At the moment i am trying to a add a Config for a Header and a Footer Menu. Both Menus should be populated automatically. Though, i have run into a lot of Problems: a) The best place for the Default Menu should be hopefully the Application-Module b) I added the following to the root of module.config.php: 'view_helpers' => array( 'helper_map' => array( 'navigation' => 'Application\View\Helper\Navigation' ), ), My Navigation.php is located in ./module/Application/src/Application/View/Helper/Navigation.php

Zend Framework 2 - How to include partial from library

元气小坏坏 提交于 2019-12-04 21:35:47
问题 I wrote a partial which I want to use in several modules. I thought the best way would be to put it into my custom library. But unfortunately I couldn't figure out a way to include this partial without using a very ugly path like: echo $this->partial('/../../../../vendor/myvendor/library/MyVendor/View/Views/FormPartial.phtml' , array(...)); Any ideas how to link to my vendor directory from my view? 回答1: The problem is the resolver can't resolve the path of the view template you had provided.

How to work with cron job in zendframework 2? [duplicate]

最后都变了- 提交于 2019-12-04 19:43:33
This question already has answers here : How to run cron job with zend framework 2 (2 answers) Closed 6 years ago . I have two functions in zend framework 2, which fetch me the details of apartments from another site and save them in my data base. (BUT THEY DO SO ONLY WHEN I RUN THE FUNCTIONS). say the controller name is 'FetchFromSourceController' and the functions are 'index' and 'ical'. those are the names I used. But my requirement is those two functions should run automatically one after the other when the day begins, with a gap of 10 minutes. i.e. index action should run at 12:00 AM and

ZF2 detach listener from EventManager

南楼画角 提交于 2019-12-04 19:21:24
Implementing a new ZF2 app I found myself struggling with the EventManager. In the application module I created an AuthenticationListener and a NotifierListener . The first checks for proper authentication on users and the second displays custom messages addressed to the logged user. Now I'm creating a new module that dispatches xml files to export. I want to keep the AuthenticationListener but detach the NotifierListener to avoid E_NOTIFY errors. The problem is that after reading blogs/source code/documentation (pretty poor) and pulling my hair out I'm unable to understand how to detach the

Zend Framework 2 Db\Adapter\Adapter query resultset like ZF1

戏子无情 提交于 2019-12-04 18:52:06
问题 Just need a hand understanding some simple database queries in ZF2. In ZF1 I have simple methods like this: public function recordset() { // listing of all records $db = Zend_Registry::get('db'); $sql = "SELECT " . $this->_selectlist() . " from customer c"; $r = $db->fetchAll($sql); return $r; } In ZF2, how would I do the same? I have tried the following, but this just returns what looks like a "Result" object, but all I want is an array like ZF1 did with fetchAll. If I have to iterate the

ZF2 maintenance page

﹥>﹥吖頭↗ 提交于 2019-12-04 17:13:51
I try to set up a maintenance page with ZF2 but it's not working. I put a maintenance.html page in public folder (www) and in my onbootstrap function I've got the following code : $config = $e->getApplication()->getServiceManager()->get('Appli\Config'); if($config['maintenance']) { $response = $e->getResponse(); $response->getHeaders()->addHeaderLine('Location', '/maintenance.html'); $response->setStatusCode(503); return $response; } I enter the if cause $config['maintenance'] is true but it's not displaying my maintenance.html page as expected. Instead it displays the page asked. Is there

How to create a generic module/controller/action route in Zend Framework 2?

安稳与你 提交于 2019-12-04 17:11:01
I would like to create a generic module/controller/action route in Zend Framework 2 to be used with ZF2 MVC architecture. In ZF1 the default route was defined like /[:module][/:controller][/:action] where module would default to default , controller would default to index and action to index . Now, ZF2 changed the way modules are intended, from simple groups of controllers and views, to real standalone applications, with explicit mapping of controller name to controller class. Since all controller names must be unique across all modules, I was thinking to name them like modulename