zend-framework2

ZF2 Form Hydration with multiple objects and fieldsets

蹲街弑〆低调 提交于 2019-12-12 15:33:11
问题 I'm struggling trying to work out how to edit multiple models with a single form. I have a database table called Teams and a doctrine entity associated with this table. I create a form as below: My team fieldset: class TeamFieldset extends AbstractFieldset implements InputFilterProviderInterface { public function init() { $this->setName('Team') ->setHydrator(new DoctrineHydrator($this->getObjectManager(),'Application\Model\Entities\Team')) ->setObject(new Team()) ->setLabel('Team'); $this-

zf2 form: populate select field with data coming from database

最后都变了- 提交于 2019-12-12 13:55:32
问题 I'm learning zf2 and I'm facing a problem involving 2 (eventually more) modules working together. Note, I've carefully read this post (and the related one) which helped me a lot. I'm going to explain a bit the problem: Using the first module (FrOption) an administrator can manage website form options. All options are stored in a db table like this: id|field_name|field_value 1|country|germany| 2|country|france| 3|gender|Male| 4|gender|Female| 5|tipo|Car| 6|tipo|Fly| ... In my module (FrItem) I

Multiple controller in one module in zend framework

耗尽温柔 提交于 2019-12-12 13:40:11
问题 hi i am new in zend framework2.2.0. i want to create one module with multiple controller i have download "Album" module from github and its working fine Now i want to add the more controller in it the below i have shown my folder structure for file in module module/ Album/ config/ module.config.php src/ Album/ Controller/ AlbumController.php UserController.php Form/ AlbumForm.php UserForm.php Model/ AlbumTable.php Album.php UserTable.php User.php view/ album/ album/ index.phtml user/ index

ZF2 - Zend Framework 2, understanding routing

為{幸葍}努か 提交于 2019-12-12 13:39:05
问题 I am trying to get my head around Module routing in ZF2. At the moment I am only able to create a single controller for a single action and am struggling to figure this routing out. I have looked at other modules and plugins and I kind of get it, just need a small push to "get it". In this example I am trying to route to the two actions: indexAction and cmstoolsAction Essentially a user navigates to: /affiliates/overview /affiliates/cmstools And the error is: The requested URL could not be

ZF2 Fieldsets and Form Binding

不想你离开。 提交于 2019-12-12 13:34:44
问题 I'm trying to create one page with a Form with two fieldsets that should each populate a different table. I can easily create One form as in the Album tutorial, and bind the data like this: $pageForm = new PageForm(); $pageForm->bind($page); with my PageForm class as follows: class PageForm extends Form { public function __construct($name = null) { // we want to ignore the name passed parent::__construct('page'); $this->setAttribute('method', 'post'); $this->add(array( 'name' => 'id',

Annotations Namespace not loaded DoctrineMongoODMModule for Zend Framework 2

故事扮演 提交于 2019-12-12 13:23:45
问题 I've loaded up the Doctrine MongoODM Module for zf2. I have got the document manager inside my controller, and all was going well until I tried to persist a document. It fails with this error: "[Semantical Error] The annotation "@Document" in class SdsCore\Document\User was never imported." It seems to fail on this line of DocParser.php if ('\\' !== $name[0] && !$this->classExists($name)) { It fails because $name = 'Document' , and the imported annotation class is 'Doctrine\ODM\MongoDB

No role detected by BjyAuthorize when login

无人久伴 提交于 2019-12-12 12:27:39
问题 I am working with ZF2, Doctrine ORM and BjyAuthorize. The problem is that when I got logged in the method getRoles of the identity returns empty. class User implements UserInterface, ProviderInterface{ /** * @var \Doctrine\Common\Collections\Collection * * @ORM\ManyToMany(targetEntity="Application\Entity\Role", inversedBy="user") * @ORM\JoinTable(name="user_role_linker", * joinColumns={ * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id") * }, * inverseJoinColumns={ * @ORM

ZF3 redirection after ACL authorization failed

旧城冷巷雨未停 提交于 2019-12-12 11:26:36
问题 I have a new ZF3 application with ACL. Now I need, in case of unauthorized access, to redirect to an error page (403 for example). I think the best way is to fire an event, then catch it, but I failed... All is in my User module, in Module.php (extracts): namespace User; use Zend\Mvc\MvcEvent; use Zend\Permissions\Acl\Acl; use Zend\Stdlib\Response ; use Zend\View\Model\ViewModel; [...] class Module implements ConfigProviderInterface { [...] public function onBootstrap(MvcEvent $e) { // Set

Zend Framework 2 passing variable to models

≡放荡痞女 提交于 2019-12-12 10:50:48
问题 I'm currently developing a multilangual website. For the multilangual part i use translator / poedit. I store the selected language in session. It works fine. Module.php: public function onBootstrap(MvcEvent $e) { // ... $session = new Container('base'); if ($session->language !== NULL) { $e->getApplication()->getServiceManager()->get('translator')->setLocale($session->language); } } Action for setting language in a controller: public function setLanguageAction() { $language = $this->params()

Picking up ZF2, is it worth it now? [closed]

人走茶凉 提交于 2019-12-12 10:40:24
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I've been a web developer for the past 8 years (although I'd only consider the second half of that time as real experience) In the