zend-framework2

How to force composer to reinstall a library?

白昼怎懂夜的黑 提交于 2020-01-11 15:25:11
问题 I'm using the ZF2 skeleton app and it has a .gitignore that prevents external libraries from being commited to git. While debugging I like to go and change stuff here and there in the libraries' source to learn how things work. If these were version controlled it would be very easy to revert them back to their original state. How can I force Composer to reinstall a particular framework so that I can get a fresh -unmodified- copy again? PS: Please don't suggest removing the .gitignore file

How to build nested responses in an Apigility driven application with a ZfcBase-DbMapper based model?

旧时模样 提交于 2020-01-11 11:42:14
问题 I'm developing a RESTful web application -- Apigility driven and based on the Zend Framework 2. For the model layer I'm using the ZfcBase DbMapper. The model essentially consists of two entities: Project and Image ( 1:n ) and is currently implemented like this: ProjectCollection extends Paginator ProjectEntity ProjectMapper extends AbstractDbMapper ProjectService implements ServiceManagerAwareInterface ProjectServiceFactory implements FactoryInterface The same structure for Image . When the

Zend Framework 2 Library Paths

假如想象 提交于 2020-01-11 09:47:06
问题 Trying to get my feet wet on ZF2 and I've stumbled on my first problem. Say on a module I want to use Shanty_Mongo (an external library to connect to MongoDb) So I've copied the entire Shanty directory on the library and created a new Model class: namespace Dummy\Model; use Shanty\Mongo\Document; class Dummy extends Shanty_Mongo_Document { public function setConnections( $connections ) { Shanty_Mongo::addConnections($connections); } } (The setConnections() is to be used by DI, if I've

ZF2 + Doctrine2: Server has gone away - how to jog an old connection?

假如想象 提交于 2020-01-11 07:10:07
问题 Thanks in advance for your help. I'm wondering if anyone quickly knows what functions to call on the Entity Repository to jog its reconnection if it is dead. I am running some jobs that can take a length of time that exceeds wait_timeout through a ZF2 CLI route, and unfortunately, the ER's connection dies by the time it needs to get used (when the job is done). Need: // do the long job $sl = $this->getServiceLocator(); $mapper = $sl->get( 'doctrine_object_mapper' ); if( !$mapper-

ZF2: Get module name (or route) in the application layout for menu highlight

北战南征 提交于 2020-01-11 05:10:02
问题 How can I get in ZF2 the current (selected) module name in the application layout? Purpose: My application layout include the main menu of the zf2 app, and every time a module is selected I need to highlight the menu voice of the module. Also I need to set the correct route (url, action) when the menu is made with this for. Every module has a menu voice: <ul class="nav"> <?php foreach ($menu_modules as $mod): $is_active = ($mod['name'] == $CURRENT_MODULE_NAME)?'selected':'';//GET MODULE NAME

ZF2: Get module name (or route) in the application layout for menu highlight

时光总嘲笑我的痴心妄想 提交于 2020-01-11 05:09:04
问题 How can I get in ZF2 the current (selected) module name in the application layout? Purpose: My application layout include the main menu of the zf2 app, and every time a module is selected I need to highlight the menu voice of the module. Also I need to set the correct route (url, action) when the menu is made with this for. Every module has a menu voice: <ul class="nav"> <?php foreach ($menu_modules as $mod): $is_active = ($mod['name'] == $CURRENT_MODULE_NAME)?'selected':'';//GET MODULE NAME

COUNT and GROUP BY using Zend Framework 2 and tableGateway

家住魔仙堡 提交于 2020-01-10 19:35:08
问题 In Zend Framework 2, using tableGateway, I want to run the following SQL query: SELECT categories.category_name, COUNT(forums.forum_id) FROM categories LEFT JOIN forums ON categories.category_id = forums.category_id GROUP BY categories.category_name; Problem is that I simply don't know how to do it. I know how to use $select->join() for example, but I can't figure out how to also do a COUNT and GROUP BY . What I want with my SQL: I have 2 tables; categories and forums . I want to select all

Zend Framework 2: get matched route in view

别等时光非礼了梦想. 提交于 2020-01-10 18:43:21
问题 I'm currently learning ZF2 by developing a small MVC application roughly based on the skeleton app. Right now I'm trying to hide some fixed HTML elements based on the route matched: just as an example, I don't want the main menu to show during the login phase. I can do that easily by passing toggle parameters as return values from the controller actions, but it doesn't feel right, so I'd like to just check the matched route from the layout and compose the layout accordingly. Problem is, I don

How can i do update table doctrine

筅森魡賤 提交于 2020-01-07 09:45:50
问题 I have this script for inserting the data: echo "Update "; $department = new Department(); $department->setNamedepartment($data ['nameDepartment']); $department->setCodedepartment($data ['codeDepartment']); $department->setIdfkgeographicalarea($data ['idFkGeographicalArea']); $entityManager->persist($department); $entityManager->flush(); how can I update my $department entity with only this call: update($data,$id) ? 回答1: function update ($data, $id) use ($entityManager) { $departament =

SSL error in CURL call to Twitter API

孤街浪徒 提交于 2020-01-07 07:26:11
问题 Below is some code of my controller (dont worry, de keys are fake). Im using the ZendService\Twitter\Twitter module. Almost everything is working only the last error is a bit strange and i can not figure it out: Unable to enable crypto on TCP connection api.twitter.com: make sure the "sslcafile" or "sslcapath" option are properly set for the environment. As you can see i the code below of my controller, you can see that both the Verify of Peer and Host are set to false. The adapter is already