zend-framework2

Handeling M-N Relationship in Zend Framework 2

最后都变了- 提交于 2019-12-06 06:21:21
问题 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

ZF2 register custom helper for navigation

非 Y 不嫁゛ 提交于 2019-12-06 06:13:30
I am using Zend Navigation with ACL . My users can have multiple roles, which have no relation to each other, but Zend Navigation only accepts one role and checks the ACL with that role which is not good for me. How can I register a new Helper for the Navigation such that I can override the acceptAcl method. I tried to create and register a simple view helper but that didn't work class Menu extends \Zend\View\Helper\Navigation\Menu implements \Zend\ServiceManager\ServiceLocatorAwareInterface { protected function acceptAcl(AbstractPage $page) { if (!$acl = $this->getAcl()) { // no acl

Zend Framework 2: Navigation

浪子不回头ぞ 提交于 2019-12-06 05:56:15
问题 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

How to use Zend Service Amazon?

陌路散爱 提交于 2019-12-06 05:46:22
问题 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

how to return an array of objects in zend framework 2?

梦想的初衷 提交于 2019-12-06 05:37:10
问题 I am doing a query in zf2 and i get back a object(Zend\Db\ResultSet\HydratingResultSet) that i have to a foreach on, in order to get to the properties. I would like to get an array of objects by default. here is some code i have: factory 'address-mapper' => function ($serviceManager) { $mapper = new Mapper\Address(); $mapper->setDbAdapter($serviceManager->get('Zend\Db\Adapter\Adapter')); $mapper->setEntityPrototype(new Entity\Address); $mapper->setHydrator(new \Zend\Stdlib\Hydrator

ZF2 Get params in factory

一世执手 提交于 2019-12-06 05:35:32
I have a dynamic category navigation. In the navigation factory I want to get a param from the route. How can I do this? In my view <?php echo $this->navigation('CategoryNavigation')->menu()->setUlClass('list-group'); ?> In my module.php: public function getServiceConfig() { return array( 'factories' => array( 'CategoryNavigation' => 'Application\Navigation\CategoryNavigation', ) ); } This is my navigation factory. I need to get the slug from the route where {{ store slug }} (2x) is defined. <?php namespace Application\Navigation; use Zend\ServiceManager\ServiceLocator; use Zend\ServiceManager

Zend Framework 2 including custom library

随声附和 提交于 2019-12-06 05:22:25
My directory structure is like this: c:\Workspaces\Zend c:\Workspaces\Custom library Custom library is a shared library, which is in use in other applications. It doesn't use namespaces, just old style underscores. I downloaded the ZF2-Restful-Module-Skeleton which i intend to use as a restful server. In the InfoController I have this code: namespace Main\Controller; use Zend\Mvc\Controller\AbstractRestfulController; class InfoController extends AbstractRestfulController { public function getList() { $data = array( 'phone' => '+30123456789', 'email' => 'email@domain', ); $Res = new CL_Res

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

自闭症网瘾萝莉.ら 提交于 2019-12-06 04:48:35
问题 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

ZF2 Generate navigation using zfcrbac zfcUser and hierarchical role strategy

烈酒焚心 提交于 2019-12-06 04:30:12
I begin in zf2 and i have to handle Many to Many permissions/roles. Using ZfcRbac . So i make a mapping with User / Hierarchical Role (table name= role) / permissions And i make some guards with deny policy. My guard, mapping, database, are ok. My HierarchicalRole Entity looks like : class HierarchicalRole implements HierarchicalRoleInterface And it's, for now the same as the original given by Bakura. My user Entity looks like this : class User extends ZfcUserEntity implements IdentityInterface with /** * @var \Doctrine\Common\Collections\Collection * @ORM\ManyToMany(targetEntity=

How do I set expire time for Zend Cache Storage?

丶灬走出姿态 提交于 2019-12-06 04:26:01
问题 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