zend-framework2

Zend Framework 2, PDO dblib driver, how to change SQL Platform Decorator

筅森魡賤 提交于 2019-12-11 19:24:21
问题 It seems that ZF2 with the PDO:dblib driver defaults to using the SQL92 SQL decorator. How do I use the DI system to tell it to use the SqlServer decorator instead? Just can't get my head around it. The issue is that the paginator attempts to use LIMIT/OFFSET syntax which doesn't work in SQL Server. Another way of phrasing it is how do I customise the Paginator returned from fetchAll() on a table object to use the SqlServer platform? Chris 回答1: OK, well I found there's a much easier way to do

Get request parameters in controller's constructor Zend Framework 2

假装没事ソ 提交于 2019-12-11 18:53:16
问题 I have 10 actions in one Controller. Every action required ID from request. I want to check ID in constructor for every action, so I want avoid to write the same code 10 times in every action. obviously, In constructor I can not use functions like: $this->params()->fromQuery('paramname'); or $this->params()->fromRoute('paramname'); So, the question is how to get request params in controller's constructor? 回答1: Short answer: you cannot. The plugins (you are using params here) are available

ZF2 - Error Handling for a Specific Module Only

回眸只為那壹抹淺笑 提交于 2019-12-11 18:17:25
问题 I have a multi-modular app. And one of its modules listens to "dispatch.error" with 999 priority. And it appears to catch errors from all other modules. What I need is to catch error in my specific module only and behave appropriately. It will work if I for example will listen to "dispatch.error" with 1000 priority and filter out errors specific to my module (by exception names or using route filtering), but there's no guarantee that some other module won't come with 10000 priority for the

ZF2 already active query prevents execution

僤鯓⒐⒋嵵緔 提交于 2019-12-11 18:14:22
问题 I have something like the following, in a function that deletes both the files and db entries: $adapter = $this->getAdapter(); $query = $adapter->query("call find_results_by_job_id(?)", array($jobId)); $items = array(); while (($current = $query->current()) !== false) { $id = $current['id']; $items[] = $id; $query->next(); } $this->deleteFromDataStore($items); $result = $adapter->query("call delete_results_by_job_id(?)", array($jobId), \Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE); (Some of

Issue with quoting of IS, NULL, NOT, !, and other reserved strings in ON conditions of JOIN clauses in Zend Framework 2

帅比萌擦擦* 提交于 2019-12-11 17:57:43
问题 I have an SQL statement, that selets sport classes/courses ( courses ) with their trainers ( trainers ) over an association table ( courses_trainers ). Since some courses have multiple trainers, I use the GROUP_CONCAT(...) function to get the trainer names into one field. Some trainers rows are empty or NULL , so I add a trainers.name IS NOT NULL and a trainers.name != "" condition to the ON clause of the trainers JOIN : SQL statement SELECT courses.id AS id, GROUP_CONCAT(DISTINCT trainers

How to install ZF2 in ubuntu 12.04 + virtual host + mod_rewrite [closed]

。_饼干妹妹 提交于 2019-12-11 17:34:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I installed zf2 skeleton application and some modules like zfcuser and zfcBase from https://github.com/ZF-Commons/ZfcUser and I installed it successfully in my local at the end I ran 192.168.3.12/myproject/user but I found 404 not found error always I have to run 192.168.3.12/myproject/public/user so I found

Doctrine validate-schema PDOexception

微笑、不失礼 提交于 2019-12-11 17:29:00
问题 When I do this step on marco pivetta tutorial Validate-schema I have this error : [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) The problem is, on line command i think my doctrine.local.php return array( 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver', 'params' => array( 'host' => 'localhost', 'port' => '3306', 'user' => 'root', 'password' => '', 'dbname' =>

Doing inserts with zend 2's tableGateway

元气小坏坏 提交于 2019-12-11 17:26:19
问题 I using zf2's tableGateway and I'm unsure of the design it leads to. Here is the canonical example of how to use zf2's tableGateway to do an insert (this from the docs): public function saveAlbum(Album $album) { $data = array( 'artist' => $album->artist, 'title' => $album->title, ); $id = (int)$album->id; if ($id == 0) { $this->tableGateway->insert($data); } else { if ($this->getAlbum($id)) { $this->tableGateway->update($data, array('id' => $id)); } else { throw new \Exception('Form id does

Send emails to multiple recipients from DB zend 2

无人久伴 提交于 2019-12-11 16:01:07
问题 i wan't to send the same mail to multiple recipients retreived from database, using zend framework 2. With my solution i can only send email to the first row on my database, and i do not no what's the problem exactly. This is my action in the indexController: public function eventdetailsAction() { $id = (int) $this->params()->fromRoute('id', 0); $this->layout()->setVariable('lang', $this->params()->fromRoute('lang', 'en_US')); $this->layout()->setVariable('action', $this->params()->fromRoute(

how to set a custom view in zend-framework2

怎甘沉沦 提交于 2019-12-11 14:54:58
问题 I am trying to return a custom view using ajax in zend framework2. This view may be changed dynamically according to the condition in ajax call.. So how i can return a full view through ajax in zf2 ? 回答1: You can return a full view through ajax in the same way as you would return a full view through your browsers location bar. If you just want to return html, then simply return a view model in the same way you usually would. You may want to disable the layout, this can be done with: