zend-framework2

Saving a Doctrine 2 Entity that contains an ObjectSelect element using Zend Form

為{幸葍}努か 提交于 2019-12-24 02:14:14
问题 I was following along with the Doctrine Hydrator tutorial, but I am having issues saving when my fieldset contains an ObjectSelect. I'm using ORM mapping on my entities. Basically I have a Role entity with id and name . I also have a User entity with id , name and role (ManyToOne). I also have my getters and setters. My setRole() method passes the Role entity as a parameter. /** @param Role $role */ public function setRole(\Application\Entity\Role $role) { $this->role = $role; } I setup a

Apigility - How to use Doctrine ORM Module from ZF2 command line

馋奶兔 提交于 2019-12-24 01:44:19
问题 Hi i'm new with Apigility. Im trying to configure doctrine-orm-module. When i tried to run the command below and getting this error $ cd /var/www/apigility/zf-apigility-skeleton/vendor/doctrine/doctrine-module/bin $ php doctrine-module.php Error is: PHP Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for doctrine.cli' in /var/www/apigility/zf-apigility

Request to Random.org API with ZendFramework2

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 22:21:01
问题 I'm quite new to ZF2 and I wanted to create some app utilizing external API. I have successfully created method to send requests to random.org API but as a response it sends me an error connected with parsing. I have no idea what I'm doing wrong and how to improve my method to get proper data in response. Here is my method used to send request (I have intentionally changed api key and in my app I'm using the proper one): public function makeRequest() { $data = array( 'jsonrpc' => '2.0',

ZF 2: tutorial application, 'Config being merged must be an array […]'

 ̄綄美尐妖づ 提交于 2019-12-23 21:28:00
问题 My Enviroment (Zend Server): PHP Version 5.4.11 Zend Server Version: 6.0.1 Zend Framework: 1.12.3, 2.1.4 Zend Server Gateway: 0.9.0.201301302347 Build: 69400 So I tried to write my first application in ZF2 form official tutorial. ZF version in skeleton application: 2.2 This is link to my project, if someone wants to look at it closer. config/module.config.php <?php return array( 'controllers' => array( 'invokables' => array( 'Album\Controller\Album' => 'Album\Controller\AlbumController', ), )

zf2 Form Validator DateTime dateInvalidDate

我只是一个虾纸丫 提交于 2019-12-23 21:20:03
问题 Trying to use a DateTime Form element in ZF2 and cannot valid the form. $inputFilter->add(array( 'name' => 'event_datetime', 'required' => true, 'filters' => array( array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'min' => 0, 'max' => 20, ), ), ), )); Using this on the .phtml file. <?php $formElement = $form->get('event_datetime');?> <dt><?php echo $this->formLabel($formElement);?></dt> <dd><?php echo $this-

Doctrine2 entity with varchar id don't insert id into database

霸气de小男生 提交于 2019-12-23 20:15:25
问题 I'm trying to make entity for Doctrine2 in ZF2 Application. My entity should have id varchar(15) but when I'm trying to create new row, doctrine2 is not pushing this ID into the database. In entity generated class I have this: /** * Checkpoints * * @ORM\Table(name="checkpoints", uniqueConstraints{@ORM\UniqueConstraint(name="sort", columns={"sort"})}, indexes={@ORM\Index(name="country", columns={"country"})}) * @ORM\Entity */ class Checkpoints { /** * @var string * * @ORM\Column(name="id",

ZF2 routing configuration

这一生的挚爱 提交于 2019-12-23 17:27:40
问题 I've just built a zf2 project and i'm having a configuration problem. When i go to mydomain.com this routs as specified in configuration files to Application module, index controller, index action. But If i type mydomain.com/otheraction this is not routed to Application module, index controller, otheraction action. Of course, since it isn't configured to do this. So my question would be how do i configure the app to do that? I've added my Application/config/module.config.php file and the main

Why does recursive submodule update from github fail for DoctrineMongoORMModule?

∥☆過路亽.° 提交于 2019-12-23 16:16:14
问题 Is this something I am doing wrong, or a wider bug? If I execute the following git commands in an empty directory: git init git submodule add https://github.com/doctrine/DoctrineMongoODMModule \vendor\DoctrineMongoODMModule git submodule update --init --recursive The all goes well, multiple submodules are pulled, and then it fails with the following output: fatal: not a git repository: ../../../../../../../../../../.git/modules/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules

How to trigger an event attached to the Shared Event Manager in ZF2?

会有一股神秘感。 提交于 2019-12-23 15:39:26
问题 An event attached to a (local) event manager public class myClass implements EventManagerAwareInterface { ... public function __construct(...) { ... $this->getEventManager()->attach('doEvent', function ($e) { $event = $e->getName(); $params = $e->getParams(); printf( 'Handled event "%s", with parameters %s', $event, json_encode($params) ); }); } ... public function getEventManager() { if (!$this->eventManager) { $this->setEventManager(new EventManager()); } return $this->eventManager; }

View Helper Manager not accessible in Module Bootstrap using ZF3

Deadly 提交于 2019-12-23 15:07:23
问题 Using Zend Framework 2 I can access the ViewHelperManager doing this: public function onBootstrap(MvcEvent $e) $viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager'); } This does not seem to work anymore in my Modules since starting a new project using Zend Framework 3 . Not quite sure what to do here. 回答1: The Services are uppercased in Zend Framework 3 apparently. $viewHelperManager = $e->getApplication()->getServiceManager()->get('ViewHelperManager'); var