zend-framework

Zend Query Select

岁酱吖の 提交于 2019-12-11 04:19:20
问题 Hi i need to do a simple query but something is wrong. I have $name and $surname and i need to search the (possible multiple) id that rappresent that name and surname and put all the id, name and surname in a array I do this query: $result=$this->_db_table->select()->where('name=?',$name) ->where('surname=?', $surname)->query() ->fetchAll(); $array=$result->toArray(); return $array; If i use $result=$this->_db_table->fetchAll(); $array=$result->toArray(); return $array it work correctly and i

What is the best way, inside a controller, to know if the request is a XMLHTTP one or not (ZF)

試著忘記壹切 提交于 2019-12-11 04:13:37
问题 I have different logic in an action depends if the request is an AJAX one or not. (For AJAX logins, I do not need to redirect after successful login, which is not the case in normal login, for example). What is the best way, beside checking the headers for X-Requested-With: XMLHttpRequest Is there a flag or something? 回答1: This method works by checking for a header which is set by almost (if not) all of the major JS libraries, including jQuery and YUI. $this->getRequest()->isXmlHttpRequest()

zend framework where statement in query

守給你的承諾、 提交于 2019-12-11 04:08:51
问题 How can I use And/or in mysql queries using php and zend framework.for now I am using this : $db=Zend_Db_Table::getDefaultAdapter(); $select=new Zend_Db_Select($db); $select->from('users','*'); $select->joinInner('rest', 'users.repository = rest.id',array('username')); $select->where('username='.$rest.' and sold=0'); return $db->fetchAll($select); is that the correct way ? if not what is the correct way? 回答1: You can add AND 's to your query by calling where() multiple times: $select->where(

Zend_Auth identity versioning

坚强是说给别人听的谎言 提交于 2019-12-11 04:07:58
问题 There is a situation: I store some structured data (e.g. array or object, or even string) as a Zend_Auth identity. From version to version the structure of identity could be changed thus identity from one version could (or could not) be compatible with application code of another version. I'd like to have an ability to validate whether the stored identity data conform to current version requirements. As I see from the manual, the verification of whether the identity exists is performed like:

Hostname and Custom routing in Zend Framework don't work together for me

会有一股神秘感。 提交于 2019-12-11 03:52:51
问题 I am building an application that uses hostname routing to detect subdomains like user1.example.com user2.example.com and also have custom routes like user1.example.com/login This works well so far, however when I add custom routes they do not work. I have searched and read a lot but seems there is something I am missing. Here is what I have so far: //my routes in routes.ini [development] routes.login.type = "Zend_Controller_Router_Route" routes.login.route = "/login" routes.login.defaults

Best approach on excluding fields from a validator

别说谁变了你拦得住时间么 提交于 2019-12-11 03:39:35
问题 I create my forms via extending Zend_Form. And I use one Form for addAction() and editAction() . When I want to remove Elements within the editing process I can do so easily via $form->removeElement('x') . But what would be the best approach on removing a field from the validator? 1) Removing and Adding the newly set validator //Controllers editAction() $form->removeValidator('Db_NoRecordExists'); $form->addValidator('Db_NoRecordExists', true, array( 'table'=>'table', 'field'=>'field',

Zend Elements and setRequired, setAllowEmpty, NotEmpty

烂漫一生 提交于 2019-12-11 03:37:09
问题 I am validating a data array against a Zend Form where some elements are required, i.e. setRequired(true), and others are optional, i.e. setRequired(false). When the data array contains keys matching the optional elements, I need the validation to run on this data. When there are no such keys, the validation should NOT run. This sounds pretty simple but it has got me stumped. On the optional elements I used setAllowEmpty(false), thinking that Zend Validate would force validation when there

How do I pass a dynamically created list to the controller to save into the database?

旧街凉风 提交于 2019-12-11 03:34:31
问题 I am working in Concrete5 and am new to the MVC concept. I have a some jquery that creates an unordered list from a textbox in my view. If your familiar with Concrete5 this is the view for the block I am adding the list to. It is basically a list of features for a product. This view needs to save the list to the database base file. Usually this is done pretty simply using a variable that the information gets saved to (aka this is how everything else in the view is saved). The problem I am

404 error for mod_rewrite using SSL and MAMP

隐身守侯 提交于 2019-12-11 03:29:45
问题 I am building an app in Zend Framework at the moment and testing it all locally. I have Mamp Pro as my web server and I have a self-signed SSL which all seems to work. My problem comes when I try to do mod_rewrite - I just get 404 pages. The way I have things set up (which may not be the best way...) In Mamp I have 2 virtualhosts set up both pointing to the same web directory (webroot/public/): secure.myapp.com myapp.com In my public directory is my index.php file and my .htaccess file. The

How to serialize large objects/arrays to JSON

三世轮回 提交于 2019-12-11 03:24:14
问题 My app needs to produce json of an object that has a large data property of type array. The array needs to remain in memory as it collects DB output and some properties can only be determined once the array is completed. Complication: the array is numerically-based and must appear as such in the json output, therefore straight json_encode() is not an option. To make this possible on low-spec machines like RasPi I've looked into trimming memory consumption: Use SPLFixedArray Use string and