zend-framework2

Zend Framework 2 - ZFCUser - How to exclude landing page from auth

≡放荡痞女 提交于 2019-12-24 08:24:58
问题 I'm using ZF2 in combination with ZFCUser and bjyauthorize . I have a landing page which should be globally accessable. All other pages need to be behind a login. At first I blamed bjyauthorize for not letting guest users access my landing page. But after some discussions it seems that ZFCUser is blocking the way. My question is: How can I tell ZFCUser not to block one page/action? Edit: My Application/Module.php looks like in this post. When I add my app myApp to the whitlist, I can access

A plugin by the name “getServiceLocator” was not found in the plugin manager Zend\Mvc\Controller\PluginManager

老子叫甜甜 提交于 2019-12-24 08:19:02
问题 Recently started learning AngularJS and Zend Framework 2 through a course. Given the year of the course, which if I remember is 2013, some things have changed in both frameworks. Soon, I came across a problem using the following code snippet to test the connection to the database and list the records using Doctrine 2: namespace Application\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class IndexController extends AbstractActionController {

Returning missing results from many to many table

我的未来我决定 提交于 2019-12-24 08:09:18
问题 I have a table structure like following: Brands => BrandUser <= Users I need to get brands which have corresponding record in the BrandUser table and the ones which don't have corresponding record in BrandUser table... I have tried the following query: public function getUserBrands($userId) { $select = new Select(); $select->from(array('bu' => $this->table)); $select->join(array('b' => 'brands'), 'bu.brandId = b.id', array('id','name')); $select->join(array('u' => 'users'), 'u.id = bu.userId'

ZF2 Doctrine get manytomany relations with objectSelect

倾然丶 夕夏残阳落幕 提交于 2019-12-24 05:13:38
问题 I have multiple users, with multiple stores in a many to many relational database. Every user has multiple stores attached to them. Now, i want to load all the storenames from a logged in user in a select form. How can i do this? My user entity: namespace Application\Entity; use BjyAuthorize\Provider\Role\ProviderInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use ZfcUser\Entity\UserInterface; /** * An

How to start a big new ZF2 project?

 ̄綄美尐妖づ 提交于 2019-12-24 05:00:34
问题 I am going to create a new project with ZF2 . In fact I'll have to upgrade a project ZF1 but I decided to start from scratch. My project is very large and has already been translated into 10 different languages ​​by volunteers from all parts of the world. The difficulty I am having is the analysis of the structure of the modules that ZF2 tells me to follow. The software allows SMEs in the world of ISPs to manage their customer database , services, orders, invoices , domains , technical

Runnig Zend Framework 2 action from console not working

陌路散爱 提交于 2019-12-24 04:09:12
问题 I have a ZF2 application running from web server properly. I need to run some action from command line because I want to do some scheduled task (cron jobs). So I found these useful links: Zend Framework's official document, Samsonasik's blog. I have started by adding console route on module.config.php in GeneratePdf module. Here is the segment of console route. 'console' => array( 'router' => array( 'routes' => array( 'generate' => array( 'options' => array( 'route' => 'generate all [-

return table primary key name with tableGateway

夙愿已清 提交于 2019-12-24 03:35:23
问题 I'm trying to create an abstract object for my Table Objects. Today I have lots of object like: CategoriaTable , FornecedoresTable , etc that implement $this->tableGateway->insert() , $this->tableGateway->update() , etc I created an TableAbstract that contains most of those functionallities, but I stuck on one problem: // In CategoriaTable my table id is named cat_id $this->tableGateway->update($object->getArrayCopy(),array('cat_id' => $object->getId())) // But in FornecedoresTable my table

Passing values to view in Zend Framework 2

六眼飞鱼酱① 提交于 2019-12-24 03:27:23
问题 I'm trying to convert our existing application from Zend Framework 1 to Zend Framework 2 and I'm having a little trouble. In the original application I had the following in my controllers function init() { $this->initialize_values(); } All my controllers extended a base class which had that function in it as seen here. protected function initialize_values() { $this->_db = Zend_Registry::get('dbAdapter'); $this->_current_user = new User(&$this->_db); $this->_auth = Zend_Auth::getInstance(); if

How to attach custom styles into zf2 forms

喜夏-厌秋 提交于 2019-12-24 03:07:32
问题 Maybe its obvious problem but could you please tell me how can I add custom css styles to forms created by standard view helpers in zend framework 2? Im trying to attach some styles to forms created by ZfcUser 回答1: Assign the class-attribute :) $this->add(array( 'name' => 'element_name', 'options' => array( 'label' => 'element_label' ), 'attributes' => array( 'type' => 'element_type', 'class' => 'testing' ) )); Since you want to extend an existing form, you could either grab the Form and then

Zend Framework 2: passing variables (“options”) to form using formelementmanager

纵然是瞬间 提交于 2019-12-24 02:22:42
问题 I need to programmatically change the behaviour of a form based on some options. Let's say, for example, I'm displaying a form with some user's info. I need to display a checkbox, "send mail", if and only if a user has not received an activation mail yet. Previously, with ZF1, i used to do something like $form = new MyForm(array("displaySendMail" => true)) which, in turn, was received as an option, and which allow'd to do class MyForm extends Zend_Form { protected $displaySendMail; [...]