zend-framework

Using FORCE INDEX with zend

时间秒杀一切 提交于 2019-12-11 02:32:45
问题 I try to find how to translate the following MySQL query into Zend Db Table Select: SELECT ColA,ColB,ColC FROM MyTable FORCE INDEX(ColA,ColB) WHERE ColA = 'val0002' AND ColB = 'val0045' i try to use something like this: $select = $dbTable->select() ->from('MyTable',array('ColA','ColB') ->forceIndex(array('ColA','ColB')) ->where("ColA = 'val0002'") ->where("ColB = 'val0045'"); I found " forceIndex(array('ColA','ColB')) " in a forum, but it does not work :( and thank you for helping me :) 回答1:

Can't insert value to mapped column in Doctrine 2 in OneToOne relation

不羁岁月 提交于 2019-12-11 02:26:21
问题 I am quite new to Doctrine and need help in one situation. I have 2 simple tables Albums & Genre. Please check the structures below: Albums id | title | genre_id | createdon 1 | Album 1 | 1 | 21/05/2015 2 | Album 2 | 2 | 21/05/2015 Genre id | genre | active 1 | Pop | 1 2 | Blue | 1 3 | Rock | 1 4 | Country | 1 genre_id from Albums table is mapped to id column of Genre table. In Albums entity I have mapped this by the below process: /** * @ORM\OneToOne(targetEntity="Genre", mappedBy="albums")

Zend Framework: only index view renders 404 error when trying to access other views via /controller/action url

前提是你 提交于 2019-12-11 02:25:04
问题 I am new to Zend Framework. I am running Apache 2.2 and have set the DocumentRoot in the httpd.conf file to the public directory created using Zend_Tool. Within the public directory I have an .htaccess file; RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] ...and an index.php file; <?php // Define path to application directory /*defined('APPLICATION

What is Layout and what is View in ZF? When and whose variables should I use and why?

半腔热情 提交于 2019-12-11 02:22:17
问题 I can't understand when to use Layout 's variables and when to use View 's variables to get page segments on the page. Here is the picture form their Layout package tutorial ( $this means the View instance everywhere): Why Navigation , Content and Sidebar segments are got as Layout variables? $this->layout()->nav; But HeadTitle , HeadScript , HeadStylesheet are got straightly from View? $this->headTitle(); // I know that this is a placeholder view helper. // But this segment of the page

zf2 way to set up a navigation bar

女生的网名这么多〃 提交于 2019-12-11 02:22:02
问题 I'm struggling to connect the dots between the ZF1 way of initializing things in a bootstrap, and the ZF2 way of injecting things from a config file (seemingly). To wit, in ZF1, I had something like this in my boostrap: protected function _initNavigation() { $this->bootstrap('layout'); $this->bootstrap('view'); $navigation = new Zend_Navigation(); // ...code to add pages... $layout = $this->getResource('layout'); $view = $layout->getView(); $view->navigation($navigation); } In ZF2, I'm not

Zend DB Select with multiple table joins

ε祈祈猫儿з 提交于 2019-12-11 01:57:31
问题 Trying to replicate the following query using Zend_Db_Select . Any pointers? SELECT compounds.id as compounds_id, reactions.id as reactions_id, reaction_compound.number as reaction_compound_number FROM compounds, reactions, reaction_compound WHERE compounds.id IN (68,74,112) AND compounds.id = reaction_compound.compound AND reactions.id = reaction_compound.reaction; Specifically some issues I'm running into are doing multiple table joins in Zend. I'm not sure how to do the join across

How to perform an INSERT INTO SELECT query in ZF2

末鹿安然 提交于 2019-12-11 01:39:20
问题 What’s the best way to perform an INSERT INTO SELECT query in ZF2? I need to develop a function in ZF2 that selects a subset of records from one table and inserts those records into another table. If I were programming in SQL, the statement would look like this: INSERT INTO target (tgt_col1, tgt_col2) SELECT 'flag' as marker, src_col2 FROM source WHERE src_col1='mycriteria' I’ve searched the Doctrine docs and cannot find an INSERT method. I’ve posted a similar question under the Doctrine tag

Zend overwrite default view object

て烟熏妆下的殇ゞ 提交于 2019-12-11 01:23:42
问题 How can i overwrite the default view object in zend framework so i could have the custom one. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { function _initViewHelpers() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('HTML4_STRICT'); $view->setHelperPath(APPLICATION_PATH . '/helpers', ''); $view->headMeta()->appendHttpEquiv('Content-type', 'text/html;charset=utf-8') ->appendName('description', 'Zend Framework'); $view->headTitle()->setSeparator('

Joining tables within a model in Zend Php

人走茶凉 提交于 2019-12-11 01:23:11
问题 I understand the usage of Zend_Table and can obtain data using the Zend functions from the table associated with that class. For example I have a video table and in another table I have the association between the video and what category it is in. Im a little stumped how to active a select like the following within the framework: SELECT * FROM video,category WHERE category.category_id = 3 AND video.id = category.video_id I wish to do this within the video model which refers to the video table

How to Have a Bundled Configurable Product in Magento?

ε祈祈猫儿з 提交于 2019-12-11 01:21:41
问题 I've been searching about this topic on Magento forum and Google but can't find a definite answer for the question. Hope I find it here. Is it possible to have a bundled configurable products in Magento? Take for example I want to sell a set of t-shirt and short on a product page where the customer can choose the number of quantity, the color and the size for the t-shirt and short respectively. Maybe like this : T-Shirt [A configurable Product] Color : [combobox to select color] Size :