zend-framework2

Handeling M-N Relationship in Zend Framework 2

為{幸葍}努か 提交于 2019-12-04 12:47:49
With beta4 and latest beta5 the DB-Feature-Implementation appears to have pretty much finished. There's a couple of tutorials out there how to handle a single Database using the TableGateway Pattern, but it appears there is none for handling M-N-Relationships. In ZF1 we had findDependantRowset() on the TableGateway which was kind of dirty, as this simply was a second Query to the databse which pretty much isn't always neccessary. In ZF2 i expected there to be a way to have good Joins mapping to specified models, but i can't find anything within the code. Maybe i'm blind, maybe there really isn

Zend Framework 2 - Integer Form Validation

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:26:20
问题 I've got the following problem. I wrote (based on the tutorial) a form validation. The text fields work just fine but the integer field behave odd. This is my validator: $inputFilter->add($factory->createInput(array( 'name' => 'zip', 'required' => false, 'filters' => array( array('name' => 'Int'), ), ))); It lies within my Entity.php like the other filters. The odd thing is that this one accepts not even a string but ignores the required when I set it to true . I tried to replace Int with

ZF2 - multiple nav menus using the navigation view helper

不打扰是莪最后的温柔 提交于 2019-12-04 11:42:58
I am trying to use a main navigation in combination with a submenu for more specific navigating. In my layout I am calling the view helper like this: $this->navigation('main_navigation')->menu() and in my view I am calling it like this: $this->navigation('sub_navigation')->menu() The problem is that whenever I call the navigation() view helper a more than once , it just outputs the second one in both places. In other words, it's printing the subnav for both the main nav and the subnav menus. My merged config looks like this: 'navigation' => array( 'main' => array( 'home' => array( 'label' =>

ZF2 FileUpload Collection

女生的网名这么多〃 提交于 2019-12-04 11:07:55
问题 I am unable to get my fileupload collection to work. This is what I've done: https://gist.github.com/manuakasam/1ac71daf7269616f55f0 Basically the $request->getFiles() contains the proper information. So the upload to PHP itself works. But once the InputFilter runs over the data, it all gets lost. Apprently FileRenameUpload does something fishy and I can't figure out what exactly. All I know is my data gets lost... Write permissions are not the problem. I'm testing this currently on my devbox

How to run (or should I run) Composer on Openshift?

吃可爱长大的小学妹 提交于 2019-12-04 11:06:07
I am trying to create ZendFramework's Skeleton application on Openshift. I have created a PHP5 application using these instructions and cloned it locally. I cloned the ZendFramework skeleton application in the repository, then ran Composer to install dependencies locally. I then pushed my repository to Openshift, but I get the following error message: Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.' in /var/lib/openshift/559d4d8f500446844700002b/app- root/runtime/repo/init_autoloader

How to create custom form element in Zend Framework 2?

对着背影说爱祢 提交于 2019-12-04 10:36:17
问题 How can I in ZF2 create custom form element with custom validator? I want to create custom category picker that uses jQuery and content of this element should be rendered from phtml script. In ZF1 it was quite easy but in ZF2 I don't know from where to start. 回答1: A form element must implement a Zend\Form\ElementInterface . A default class is the Zend\Form\Element which you can use as a base form: <?php namespace MyModule\Form\Element; use Zend\Form\Element; class Foo extends Element { }

Zend Framework 2: Navigation

自闭症网瘾萝莉.ら 提交于 2019-12-04 10:15:27
In my controller I create the Navigation object and passing it to the view $navigation = new \Zend\Navigation\Navigation(array( array( 'label' => 'Album', 'controller' => 'album', 'action' => 'index', 'route' => 'album', ), )); There trying to use it <?php echo $this->navigation($this->navigation)->menu() ?> And get the error: Fatal error: Zend\Navigation\Exception\DomainException: Zend\Navigation\Page\Mvc::getHref cannot execute as no Zend\Mvc\Router\RouteStackInterface instance is composed in Zend\View\Helper\Navigation\AbstractHelper.php on line 471 But navigation which I use in layout, so

Using ajax in zend framework 2

China☆狼群 提交于 2019-12-04 10:04:26
i am really new to the zend framework 2 and to the programming of web applications. In my application, i want to have a button which triggers a function that changes the content of a database and returns a String which i can use to update the visible content of the website. As i don´t want the website to reload when the button is clicked, i would like to do this using ajax. After reading a couple of ajax tutorials, i imagined that the solution would look somilar to this: The HTML part: <head> <script type="text/javascript"> function myFunction() { var xmlhttp = new XMLHttpRequest(); // I am

How to use Zend Service Amazon?

一笑奈何 提交于 2019-12-04 10:01:31
I've been doing a lot of digging around and have ended up with a huge headache and no success. I am trying to use the Zend Amazon Service (within my Codeigniter framework) to fetch information about a book using its ISBN. I initially tried it with Zend 1.12 but I kept getting an error about missing parameter AssociateTag. I am now trying with Zend 2.0 but still getting problems. This is the code I am using within my controller: set_include_path(get_include_path() . PATH_SEPARATOR . 'site/libraries'); require_once 'Zend2/Loader/StandardAutoloader.php'; $autoloader = Zend_Loader_Autoloader:

How do I set expire time for Zend Cache Storage?

萝らか妹 提交于 2019-12-04 09:54:03
I would like to store some XML in a Zend filesystem cache and have it expire after 30 minutes. How does one set the cache duration / expiry? I am using Zend cache as a component and not in the context of a full ZF2 application. $cache = \Zend\Cache\StorageFactory::factory(array( 'adapter' => array( 'name' => 'filesystem', 'ttl' => 60, // kept short during testing 'options' => array('cache_dir' => __DIR__.'/cache'), ), 'plugins' => array( // Don't throw exceptions on cache errors 'exception_handler' => array( 'throw_exceptions' => false ), ) )); $key = 'spektrix-events'; $events = new