zend-framework2

How do I get the Service Manager in Zend Framework 2 beta4 to create an instance for album-table?

馋奶兔 提交于 2019-12-10 08:00:57
问题 This is the Rob Allen's Quick start Tutorial for Zend Framework beta4. Error Message:Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for album-table It seems like it fails trying to make a connection to the db, but I have not found way to tell. It's uses a closure to return an instance from the ServiceManager, but gets the above error message. module/Album/Module.php namespace Album; class Module { public function getAutoloaderConfig() { return array( 'Zend

Doctrine 2 self-referenced entity without unnecessary queries

旧时模样 提交于 2019-12-10 07:12:41
问题 I'm trying that a self-referenced entity stop from querying the database everytime I fetch the children of one object, and get the whole tree in one query. This is my entity: /** * @ORM\Entity(repositoryClass="ExampleRep") * @ORM\Table(name="example_table") */ class Example { /** * @ORM\Id * @ORM\Column(type="integer", nullable=false); * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\ManyToOne(targetEntity="Example", inversedBy="children") * @ORM\JoinColumn(name="parent",

Add caching to Zend\Form\Annotation\AnnotationBuilder

可紊 提交于 2019-12-10 06:49:51
问题 As I've finally found a binary of memcache for PHP 5.4.4 on Windows, I'm speeding up the application I'm currently developing. I've succeeded setting memcache as Doctrine ORM Mapping Cache driver, but I need to fix another leakage: Forms built using annotations. I'm creating forms according to the Annotations section of the docs. Unfortunately, this takes a lot of time, especially when creating multiple forms for a single page. Is it possible to add caching to this process? I've browsed

The target-entity “some entity” cannot be found

情到浓时终转凉″ 提交于 2019-12-10 01:58:45
问题 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

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

好久不见. 提交于 2019-12-10 01:53:00
问题 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

Zend 2: How to throw a 404 error from controller

Deadly 提交于 2019-12-10 01:23:56
问题 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. 回答1: Just try with: $this->getResponse()->setStatusCode(404); return; in your controller's action method. 回答2: class IndexController extends AbstractActionController { public function previewAction () { return $this->notFoundAction (); } } 回答3: 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

ZF2 - How to change the error/404 response page? Not just template but to set a new ViewModel

若如初见. 提交于 2019-12-09 18:27:54
问题 By default the page is set like this in the Application module.config array: 'template_map' => array( 'error/404' => __DIR__ . '/../view/error/404.phtml' I want to change the page. I want new ViewModel for it full of variables. It means that simply to change the template is not enough: 'error/404' => __DIR__ . '/../view/error/my_new_404_template.phtml' But I can't understand how to make it. I can't see the way the request comes to the 'error/404' . How to create new ViewModel for it? How to

Zend Framework 2 and SELECT count(*) query

懵懂的女人 提交于 2019-12-09 14:52:34
问题 I'm trying to do a query like this using Zend Framework 2: SELECT count(*) as num FROM mytable Here's the code I'm using to build my select statement (bear in mind I've imported the necessary classes): $select = new Select(); $select->from('mytable') ->columns(array('num'=>'count(*)'), false); This code doesn't work because the resulting query is as follows: SELECT [count(*)] AS [num] FROM [mytable] ...which throws the following error: Invalid column name 'count(*)' This is caused by the

Zend Framework 2.0.2 YouTube API

余生长醉 提交于 2019-12-09 14:10:22
问题 Question I cant seem to find any YouTube API documents on the new Zend Framework 2.0.2. Is there any external or extra downloads I need to do? All the tutorials are based on older versions of Zend! Or should I just download an older version of Zend? Answer I'm giving this answer for anyone else that may need it in the future. You will have to download Zend Framework 1.7.7. As the YouTube API uses the Gdata folder. On my research this is the only version that will support the YouTube API. Hope

ZF2 Dynamic Menu with Zend\Navigation\Navigation

别说谁变了你拦得住时间么 提交于 2019-12-09 13:13:53
问题 I want ask you about this problem. What do i need to create Dynamic Menu with Zend\Navigation\Navigation? In ZF1 i made like this: $container = new Zend_Navigation(); $pages = array( array( 'label' => 'Save', 'action' => 'save', ), array( 'label' => 'Delete', 'action' => 'delete', ), ); // add two pages $container->addPages($pages); and then in view: $this->navigation()->menu(); But in ZF2 pages are taking from config. Now i create \config\autoload\nav.global.php and here create page array.