Zend framework2 ZF2 tableGateway select

I started with the ZendSkeletonApplication and added a model extending Zend\Db\TableGateway\TableGateway. I have the following method: public function findByType($type) { $rowset = $this->select('type' => $type); return $rowset; } This works, but now if i do this: $foo = $table->findBytype('foo'); $bar = $table->findBytype('bar'); the first one works, the query it executes is: SELECT * FROM table WHERE 'type' = 'foo' The second one however executes the following que

Zend framework2 Zend Framework 2 - fastest Cache Adapter?

My Site will rely heavily on caching so which Chache Adapter should i go for? Filesystem will surely be the slowest, but which of these are the fastest? I have control over my php extensions so i could probably get all of them to work except the Zend Server ones. Are there any benchmarks to all these Adapters? Apc Adapter, Dba Adapter, Memcached Adapter, Memory Adapter, WinCache Adapter

Zend framework2 ZF2 BjyAuthorize get user highest role

I've got a little issue with BjyAuthorize: I can retrieve all the user's roles but I would like only the highest one. For example, if a user is admin, I can retrieve all his roles (guest, user and admin) but would like to display only admin. Has anyone found a solution for this?

Zend framework2 html in ZF2 Form

I wanted to know how I can remove all the HTML that form zend framework 2 automatically add? I want the result for each input is this: <label for="email" class="required"> Email </ label> <input type="text" name="email" id="email" value="" class="span5"> and not this: <label> <span> Email </ span> <input type="text" name="email" class="span5" value=""> </ label> how can I do?

Zend framework2 want to manage user and admin through zfcuser module separately

I am new with zf2 & zfcuser module. I want to manage separately user & admin through diffrent tables(user,admin) with zfcuser module. I have made a copy of the zfcuser module for admin & made changes according to new mobule like rename classes, files etc. admin module is exist in the Moudle folder. It's working fine I mean running without any error, but problem is that both modules are using single table(user) and session. Please let me know where am I wrong? I want to use separate

Zend framework2 Contstruct url to router another controller in module

I am new to ZF2. I have question for url('route-name', $urlParams, $urlOptions); ?> What should I construct $urlParams and $urlOptions when multiple controller in module? I rename Album module as Shop and it has two controllers: indexController and VendorController. In the View>Shop>Vendor>index.phtml, I add: <p><a href="<?php echo $this->url('shop', array('action'=>'add')); ?>"> Add new vendor</a></p> aiming this link would links to localh

Zend framework2 ZF2: how can the Application ServiceManager be configured to auto-add classes?

AbstractPluginManager has an interesting property called $autoAddInvokableClass which, when enabled, automatically adds any class you attempt to invoke to its list of invokables. Unfortunately, as far as I know, this behaviour is not implemented by ServiceManager itself. What would be the best way to implement this behaviour in the Application's ServiceManager such that $applicationServiceManager->get(SomeUnregisteredClass::class) would load SomeUnregisteredClass even without registering it

Zend framework2 Zend Framework 2 How to get individual radio button in view script?

I'm using Twitter Bootstrap 3. Html code for the radio buttons should look like: <div class="radio"> <label> <input type="radio" name="search_text_source" value="title" /> In the title </label> </div> <div class="radio"> <label> <input type="radio" name="search_text_source" value="content" /> In the content </label> </div> ... In the form, I create radio buttons as follows: $this->a

Zend framework2 How to query from a derived table by using select object?

I wanna implement a statement with select object in Zend Framework 2 like this: select count(*) as total from ( select id from table group by name) a; My code is : $sub = $adapter->select()->from('table')->group('name'); $sql = $adapter->select() ->columns('total'->new Expression('count(*)')) ->from(array('a'=>$sub)); When I execute the query , browser always show me that '$table must be a string, array, or an instance of TableIdentifier'. Appreciate for help!

Zend framework2 ZF2 TableGateway join

I am in the process of trying to learn OO/Zend Framework over standard PHP.. I want to scream and write a mysql query instead of using the TableGateway method. I have been following tutorials and have successfully printed out a table and some fields, although with the way I have gone about doing this, I am totally lost in how I should make this a join with another table and print out some fields there. For example. Table Fields customer Idx, Company contact Idx, First_Name This

Zend framework2 PHPUnit - The test case was unexpectedly terminated: Debug Error: Class not found: Interface not found

I get this class of error: Debug Error: Class/Interface not found And more abstract one from PHPUnit: The test case was unexpectedly terminated. Specific Example: Debug Error: /vendor/bjyoungblood/bjy-authorize/src/BjyAuthorize/Provider/Role/ZendDb.php line 22 - Interface 'BjyAuthorize\Provider\Role\ProviderInterface' not found Steps to Reproduce using Zend Studio 10.5.0 on PHP Version - 5.4 on Windows 7 64 Create a new workspace (File -> Switch Workspace -> Other). You can always switc

Zend framework2 How to create my own layout template and divide it in header.phtml, content and footer.phml? Zf2

I'm learning Zend Framework 2 and walked already through the famous Album tutorial. So I've a basic understanding what’s going on but unfortunately I miss a fundamental part about layouts. I want to build a basic Web application that supposed to have: A homepage for guests A complete different hompage for logged in user Divide the layout in header, content, footer I've installed the ZF2 Skeleton Application and the Zfcuser module. The site and registration pages show up like they supposed t

Zend framework2 Get user's profile data after auth with SocalNick/ScnSocialAuth

I have a ZF2 project and I'm using SocalNick/ScnSocialAuth (https://github.com/SocalNick/ScnSocialAuth) to enable social authentication. The auth flow is ok. I've already got the user to be authenticated using his or her social login (for example, Facebook). Now I need to know how can I get access to user's profile data from my Controllers an Views. I suspect that it must be using HybridAuth module (that is also loaded), but I couldn't find out how. Can anyone help me?

Zend framework2 Error on Injecting dependencies into your ZF2 controllers

Hi I am having errors trying to inject dependencies on my controllers. Warning: Missing argument 1 for User\Controller\LoginController::__construct(), called in /var/www/html/engsvc_dev/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php on line 170 and defined in /var/www/html/engsvc_dev/module/User/src/User/Controller/LoginController.php on line 23 Module.php public function getControllerConfig(){ return array( 'factories' => array

Zend framework2 Override View strategy for specific action

I have a application where we using AbstractRestfulController and Json strategy. ( We have a straight requirement for using this approach ). So all our request done through jQuery Ajax with json. Now I have a specific requirement for download a pdf file stored on server. I want to use php/zend headers for download file instead of exposing actual http path for file. Is there would be any solution for this following Restful approach. I am thinking of override view strategy for specific action, b

Zend framework2 Translate Form Error Messages

I've been using ZF2 since alpha so I'm not entirely new. However not to disturb my current project I setup a new SkeletonApp and it's working. I've added my Translations I needed for both English and German and they are working as expected. However, the Form Error Messages are not being translated to German, or any other language. I've read the manual but it only covers how to setup Translations based on Factories and it has no details regarding how to set up inside of the module.config.php. J

Zend framework2 zf2 The supplied parameters to DbTable failed to produce a valid sql statement, please check table and column names for validity

On authentication I am getting an error message "The supplied parameters to DbTable failed to produce a valid sql statement, please check table and column names for validity." my login controller code is $form= new login(); $request=$this->getRequest(); if ($request->isPost()) { $formValidator = new rotaryfilter(); $post=$request->getPost(); $form->setInputFilter($formValidator->getInputFilter()); $form-&

Zend framework2 how to access custom configuration information from the globa.php in Zend framework 2

I can't seem to understand how to access custom configuration data I have in global.php in my controller. I'm using zf2. Whenever I try: $config = $this->getServiceLocator()->get('config'); I get the following error: Fatal error: Call to a member function get() on a non-object I know it has something to do with the service manager/locator but I'm very new to ZF2 and the whole DI ethos. I'm totally stuck and need a simple example as to how to configure the SM to allow it to be acc

Zend framework2 Include js and css in ZF2 using AJAX or not

I have some views in ZF2 that must include js and css files. I can do so in view: $this->headscript()->appendScript(... But, when I get view result using ajax I need to get from server array with view html, css includes and js includes. Like this: array( 'html' => '<div id="timepicker-wrap"></div>', 'js_include' => array('/js/timepicker.js'), 'js_eval' => '$("#timepicker-wrap").timepicker()', 'css_include' => array('/css/timepicker.css'), ); Af

Zend framework2 zend framework skeleton application not showing properly

I have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host in the following way, in httpd-vhosts.conf NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "D:\xampp\htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> ServerName zf2 DocumentRoot "D:/xampp/htdocs/zf2/public/index.php" <Directory "D:/xampp/htdocs/zf2/public/index.php"> #DirectoryIndex index.php AllowOverride All

Zend framework2 How to setup multiple authentication adapters with fallback

I am trying to setup ZfcUser to authenticate with a fallback to LDAP. My zfcuser.global.php contains: 'auth_adapters' => array( 100 => 'ZfcUser\Authentication\Adapter\Db', 99 => 'ZfcUser\Authentication\Adapter\Ldap', ), I have created an Ldap.php as an AbstractAdapter with the following setup. I have eliminated function code for brevity: namespace ZfcUser\Authentication\Adapter; use DateTime; use Zend\Authentication\Result as AuthenticationResult; use Zend\ServiceManager

Zend framework2 ZF2 Validator File by \Zend\File\Transfer\Adapter\Http

I have HTML Code 2 input file in view of a action. <form action="#" id="appForm" name="appForm" enctype="multipart/form-data" method="post"> <input type="file" name="picture" id="picture"> <input type="file" name="attach_file" id="attach_file"> </form> After that, i submit this form to a action of controller. Code in action to get Post if($this->getRequest()->isPost()) { $item = array_merge_recursive($this->params()->fromPost(),

Zend framework2 zendframework large query, please advice on the best solution

I need some advice please, I have been looking for help on this topic but it's not something you find so often. I am also quite new to Zend, so please excuse my terminology I have a few large sql queries coming up. Most of my other queries are quite small, just a couple of joins etc, but these ones consist of many queries (drop and create temporary tables which together form the final select.) For example DROP table if exists tmp_abc; CREATE temporary table tmp_abc as SELECT .... From ... Gr

Zend framework2 Zend Framework 2 Zend/Log Logger

I try to create log file with Zend Framework 2. I found the solution by using Zend\Log\Logger and Zend\Log\Writer\Stream. In fact, it works fine. But the problem is that I need to use that code in every action method and in every controller class. Does anybody know how to create log file for the whole website WITHOUT writing the same code in every action method and in every controller class? Thank you for your answer!

Zend framework2 setTerminal removes content instead of layout

Hi i have a zf2 application. In my module i attach a listener to the MvcEvent::EVENT_DISPATCH event. In this listener i check if the user is authenticated etc. If the user is authenticated i change the layout. Now if i call $viewModel->setTerminal(true) in my action no content is shown, just the layout but i need it the other way around. https://stackoverflow.com/a/21441607/1594076 This answer somewhat explains what wrong i think but it's not real clear to me. Also the solution provided is

Zend framework2 local and remote zend server

I'm learning Zend framework 2 therefore i downloaded the zendstudio IDE included with the zend server as well. I made my little application which is working totally fine on my local zend server. I wanted to try zend PHP cloud as well so i deployed my application there with zend studio. This application didn't work perfectly there. Some of the content is working and the other parts did not load at all only white screen. I checked the server logs and this is what i found there: Function Name Z

Zend framework2 ZF2: How to install hybridauth in Zend Framework 2

I seem to be having a problem trying to install hybridauth in my ZF2 application. I have read quite a few similar issues however none of them seem to be able to resolve my issue. ERROR: with message 'Module (Hybridauth) could not be initialized.' Really not sure what I am doing wrong. Bog standard install of ZendSkeleton. I am using composer to do the install: Composer file { "name": "zendframework/skeleton-application", "description": "Skeleton Application for ZF2", "l

Zend framework2 ZF2: How Can I Use a Zend Filter Inside a Partial Loop?

I have a ZF2 view script with some variables as follows: $this->myModel = array($object1, $object 2, $object 3); $this->myContext = array(1, 2, 3, 4); $this->myFilter = new Zend\Filter\Word\SeparatorToCamelCase(); The view script calls the partial loop helper and passes the model: $this->partialLoop->setObjectKey('model'); echo $this->partialLoop('my-template.phtml', $this->myModel) In the partial script I am trying to access my context and filter as follows: $context

Zend framework2 Can't get my ZF2 application to work on a shared server

After developing my Zend Framework 2 website in local, I just bought a hosting and deployed it, but can't get it to work! First of all, my hosting service doesn't allow me to use the public folder as root, so I found this solution (adding an index.php to the root that includes the public/index.php, and an .htaccess that redirects everything to it): ZF on shared host I tested it in local, and works great, and I can access it from both mysite.loc and mysite.loc/public However, on remote it doesn't

Zend framework2 ZF2: ServiceLocator in Validator unable to fetch instance

I have implemented a custom validator class as follows class UsernameUnique extends AbstractValidator implements ServiceLocatorAwareInterface { use ServiceLocatorAwareTrait; protected $userManager; public function getUserManager() { if(!$this->userManager) { $this->userManager = $this->getServiceLocator()->get('RTUserManager'); } return $this->userManager; } public isValid() { $um = $this->getUs

Zend framework2 How to use \Zend\Cache andZend\Db\RowGateway\RowGateway together?

I have an abstract table class with code similar to this: function fetchById($id) { $id = (int) $id; $cacheName = sprintf('%s-%s', stripslashes(get_class($this)), hash('sha256', sprintf( '%s-%s-%s', get_class($this), __FUNCTION__, $id ))); if (($row = $this->cache->getItem($cacheName)) == FALSE) { $rowset = $this->tableGateway->select(array('id' => $id)); $row = $rowset->current(); if (!$row) { throw new \

Zend framework2 What is the recomended way / best practice to Poedit translate strings without a source keyword?

I'm developing a Zend Framework 2 application an having a problem with translations. Actually in the view scripts a can use the view helper Translate. Since I defined "translate" as a source keyword in Poedit ([Poedit menu] -> Catalogue -> Properties... -> Source keywords) the strings are identified by the tool and added to the tranlation list. But there are also some strings at other places, where I cannot use the/a view helper, e.g. in form classes or in the navigation. How should th

Zend framework2 Zend framework2 email validation for specific address like for gmail and to block a specific email address

I have my input filter for email address and I want to restrict a specific email service provider, please help me out with this. I have one more form and I want to allow that restricted email service provider only to be registered here. please tell me how can I restrict one particular email service provider and in another form allow only one specific email service provider. Thanks in advance $inputFilter->add($factory->createInput(array( 'name' => 'email',

Zend framework2 BjyAuthorize settings file connect with database table

I am using BjyAuthorize to control access in my project. Everything working as expected with hard coded settings in module.bjyauthorize.global.php file. But my requirement is to set users dynamically and assign their user levels dynamically. So I want to connect this file to DB tables some how and dynamically load settings. Please someone help me to get my thing done Thank you

Zend framework2 Custom authentication via SOAP webservice using ZF2

I am trying to implement Custom authentication via SOAP webservice as per Refering links http://it-cook-de.blogspot.in/2013/07/zend-framework-2-custom-authentication-with-soap-webservice-part-1.html http://samsonasik.wordpress.com/2012/10/23/zend-framework-2-create-login-authentication-using-authenticationservice-with-rememberme/#comment-6117 Now getting error as Code : <?php namespace Application\Adapter; use Zend\Authentication\Adapter\AdapterInterface; use Zend\Authentication\Resul

Zend framework2 Zend Framework 2 Autoload Third Party library using composer

I am trying to use composer to autoload a third party library into my ZF2 application - specifically Google api. I followed the answer in this post on SO, edited my composer.json "autoload": { "psr-0": {"Googleanalytics\\": "vendor/google-api-php-client/src/"} } and ran update. I can see the entry in composer/autoload_namespaces.php 'Googleanalytics\\' => array($vendorDir . '/google-api-php-client/src'), but i still get a fatal error class not found when trying to instantiate a cla

Zend framework2 How to use translate method in view helper?

Let say that we have example view helper code like this: namespace Product\View\Helper; use Zend\View\Helper\AbstractHelper; class ProductType extends AbstractHelper { public function __invoke($id) { return $this->translate('Super extra product'); # How to use this method here } } Now what it the best way to use translate in this view helper? Regards,

Zend framework2 How can I create a JOIN using USING in ZF2

I'm supporting 2 different websites. One uses the default Zend libraries in /usr/share (v 1.12) and the other uses specifically installed Zend libraries, which are v 2.3. I'm trying to copy some code across from one setup to another and have encountered a problem, that ->joinUsing( is not defined in ZF2. So can someone tell me how I can create a join, using Zend/Db in ZF2, that joins 2 tables using a USING, such that the 2nd instance of the joined column, doesn't get in the way of the que

Zend framework2 ZF2: How to pass a variable from the method attached to MvcEvent::EVENT_FINISH to the layout attached in MvcEvent::EVENT_RENDER?

I am trying to understand Zend Framework 2 (ZF2). Few days ago I bought the book "Learn ZF2: Learning By Example" by Slavey Karadzhov. Now I am reading it and trying to get some examples working. I am stuck in page 60. The example shown in the book works well, but the modification I just made does not work... Why? How to fix it? To get into the same code/situation you would have to: git clone https://github.com/slaff/learnzf2 . composer.phar self-update composer.phar install git stash git c

Zend framework2 Unable to render template

I am trying to send a form html as a json response. The problem I am having is that ZF2 can not find the forms template file. I get the error Zend\View\Renderer\PhpRenderer::render: Unable to render template "admin/categories/form.phtml"; resolver could not resolve to a file In my controller I have if (!is_null($form)) { $renderer = new PhpRenderer; $viewModel = new ViewModel(); $viewModel->form = $form; $viewModel->category = $category; $viewModel->setTempl

Zend framework2 Argument 1 passed to Application\Controller\IndexController::__construct() must be an instance of Application\Model\EmployeeTable, none given

I stuck With this Issue in Zd2 and knocking my head from last 2 days but not come up with any solution. Will be very Appreciable If anyone Can help me out with the below given error. Argument 1 passed to Application\Controller\IndexController::__construct() must be an instance of Application\Model\EmployeeTable, none given Here is my Application Module Config file module.config.php namespace Application; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; use Zend\Serv

Zend framework2 EntityManager persist expects parameter 1 to be an entity object, NULL given zend doctrine

I have this addaction controller and i'm getting this exception error though user are getting added. public function addAction() { $requestObj = $this->getRequest(); $viewModelObj = new ViewModel(); $errorMsg = array(); $userObj = new Entity\User(); try { $userRepo = $this->getDoctrineRepository('User'); if ($this->getRequest()->getQuery('id')) { $userObj = $userRepo->findOneBy(array('id'=>$this->getRequest()->getQuery('id

  1    2   3   4   5   6  ... 下一页 最后一页 共 7 页