zend-framework

Wildcard Query in Zend Lucene

$index = Zend_Search_Lucene::open("/data/my_index1"); $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::Text('type','auto')); $index->addDocument($doc); $term = new Zend_Search_Lucene_Index_Term('auto*'); $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); $hits = $index->find($query); f...

zend framework get last insert id of multi row insert using execute

How would I get the last inserted ID using a multirow insert? Here is my code: $sql='INSERT INTO t (col1, col2, col3) VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9)'; // example $stmt = $contactsTable->getAdapter()->prepare($sql); $stmt->execute(); $rowsAdded=$stmt->rowCount(); // mysql_affected_rows $lastId=$stmt->lastInsertId(); echo '<br>La...

Zend Framework autoloading classes extended by models

Hello, I'm new to zend framework so maybe this question is stupid.. I've got a default hierarchy site |--bootstrap.php |--application |--models    |-- Item.php    |-- ModelAbstract.php |--... Inside Item.php there's <?php //TODO: trying to remove this require... require_once('ModelAbstract.php'); class CF_Model_Flower ex...

How print all the weeks in an year (or first monday of year)

Hi all, How print all the weeks which start with monday and end with sunday.. like below ..using Zend_date 1 04-Jan-2010-10-Jan-2010 2 11-Jan-2010-17-Jan-2010 3 18-Jan-2010-24-Jan-2010 ...

How to validate multidimensional array in Zend ?

Hello ! I am wondering what is the best way to validate multidimensional array using Zend_Validate with Zend_FilterInput. Here is my current code: $filters = array( 'symbol' => array('StripTags', 'StringTrim'), 'mode' => array('StripTags', 'StringTrim'), ); $validators = array( 'symbol' => array('N...

How to redirect to previous URL after login.

I want to make redirection after login action to previous URL. Please tell me how to do that? ...

Zend Framework email content generation

With Zend_Framework, I wondered what is considered best practice for building up the content to send in a HTML email. In my case the content of the email that is sent is determined by a number of factors, for example the number of returned rows for a specific value in the database. Because of this it makes sense for me that the content i...

Handling one-to-many relationship with ZF partialLoop

Lets say i'm listing musical artists, each artist has basic information like Name, Age etc. stored in an artist table. They also have entries in an Albums table (album name/album cover etc), referencing the artist table using the artist id as a foreign key. I have the Model_Artist (Artist.php) file: class Model_Artist extends Zend_Db_...

Zend Framework problems using Element, sub-forms and belongsTo

Still pulling my hair out with Zend_Form and any elements that need to be placed in a sub-array. form->populate() does not work when working with elements within a sub-form that have been set to a parent array using belongsTo() - I think it is actually a bug in Zend_Form->setDefaults() but just wanted to see if anyone else has a) had the...

Zend Framework Generator generating extra line for dockblocks

I'm creating a php cli program to generate unit tests for our project. in the command line a enter a sourcefile and a destination file. If the destination file allready exists I parse it with Zend_CodeGenerator_File::fromReflection(). The destination file is the unit test class file. Then I check what methods need to be added to the unit...

How to put flash uploader between Zend Framework Form Elements

I need to put flash uploader between form elements. Could you please tell me how to do it? ...

Zend framework not showing errors

I read via this post how to turn on error reporting in Zend Framework but WHERE exactly do you put these statements? I've tried in public/index.php, in the file I'm working in, initializer.php but nothing prints out errors, always just a blank screen. It's beyond me why a framework would come with a setting like this by default. Anyone ...

how to get the number of weeks of current year using Zend_Date class

how can we get number of weeks of current year, for example if it's 2009 there are 53 weeks and 2010 has 52 ...

Zend Framework Models not loading by autoloader

I've setup my application with Zend_Application. I have an _initAutoload() method in my Bootstrap.php wich looks like this: public function _initAutoload(){ $this->bootstrap("frontController"); $front = $this->frontController; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Cli...

MySQL row declarations?

What do these mean in MySQL? I'm using MySQL workbench and I see I can specify a new column as these... (I noted my guesses) PK – (primary key) NN – (non null) BIN – (binary?) UN – (Unicode?) ZF- (???) AI – (autoincrement?) Is AI exactly like an Identity specification in MSSQL? (Can I insert a record without specifying the value and ...

How to assert link href value using Zend_Test without an DOMXPath error

Hi, What is the best way to verify that a link with a specific url and content exists on a tested page? I'm using Zend_Test and the following simplified example works fine until there is a dot (".") in the url, which obviously can happen very often... This is OK: $this->assertQueryContentContains('a[href="/index"]', 'Home'); Now if...

Zend: How can I globally set the current navigation item?

config: resources.frontController.plugins.nav = "WD_Controller_Plugin_Nav" bootstrap: protected function _initAutoloader() { $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('WD_'); return $loader; } protected function _initNav() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $...

Zend framework pdf module

I have a form which need users to fill. After being filled, I want to the page convert to PDF. Does ZF pdf module provide this function? Thanks a lot. ...

Contollers and Views - MVC in Zend Framework

I am using MVC in PHP based Zend Framework. This is more of a design question. I have a controller that has a couple of actions. These actions are accessed via AJAX from the controller's view. The controller's actions, perform Business logic by accessing data from functions inside a model, and construct or echo HTML. This HTML is spit ba...

Lucene - Zend_Search_Lucene - how to build an index for "tagged"content

Hello all, I have following problem, I need to build lucene index for articles which are tagged. Here is simplified data structure and lucene proposal: article_id -> unindexed article_title -> UnStored article_content -> UnStored article_tags -> ????? (here is the problem) So article can have multiple tags. Lets say we have an artic...