zend-framework

Zend Framework/PHPUnit: How to Stub/Mock an object method that connects to a database?

In my Zend Framework project, I have a form that I am testing. In my form, a multi-select element gets its options from a model, which gets the data from the database. public function init() { $this->addElement('select', 'Region_ID', array('multiOptions' => $this->getRegions())); } protected function getRegions() { $mapper = ne...

Zend Form: How to pass parameters into the constructor?

I'm trying to test my form. It will be constructing other objects, so I need a way to mock them. I tried passing them into the constructor... class Form_Event extends Zend_Form { public function __construct($options = null, $regionMapper = null) { $this->_regionMapper = $regionMapper; parent::__construct($options...

PHP Command Line running, zend framework set up problem

Hi, Im trying to learn how to set up a Zend framework web application from scratch. Ive been using Magento and I understand how powerful Zend is, but im over my head it seems like. So I bought a book, developing web applications with Zend 1.8 by Keith Pope, and I cant even follow past the first chapter. The thing that is confusing the ...

/regexp?/ on HTML, but not in form

Possible Duplicate: RegEx match open tags except XHTML self-contained tags I need to do some regex replacement on HTML input, but I need to exclude some parts from filtering by other regexp. (e.g. remove all <a> tags with specific href="example.com…, except the ones that are inside the <form> tag) Is there any smart regex te...

Zend Framework: How to filter input, turning zero to null, then validate null?

So I've determined that my validator does not get called when I filter the input value and turn zero into null. $this->addElement('select', 'State_ID', array('label' => 'State', 'multiOptions' => $this->getStates(), 'validators' => array($requiredBasedOnCountry), 'filters' => array($makeZeroNull))); The reason I am doing this is beca...

Problem with constants in application.ini after PHP upgrade

Hi, I've upgraded PHP on my local dev system to version 5.3.0, and there is some problem when I use constants in application.ini - following manual http://framework.zend.com/manual/en/learning.quickstart.create-project.html I have: bootstrap.path = APPLICATION_PATH "/Bootstrap.php" which leads to: Warning: require_once(APPLICATION_P...

Zend_Pdf UTF-8 characters?

Hello, I have problems outputting UTF-8 characters into pdf file with Zend_Pdf. Here is my code: // Load Zend_Pdf class include 'Zend/Pdf.php'; // Create new PDF $pdf = new Zend_Pdf(); // Set font $page->setFont(Zend_Pdf_Font::fontWithPath('fonts/times.ttf'), 12); // Draw text $page->drawText('Janko Hraško', 200, 643, 'UTF-8'); ...

Weird zend fw problem that makes me crazy!!

Hi, There is a problem that I can't resolve. I am developing a project and test on my computer which runs as expected. But when I move the project to testing server, which also has Zend Server CE, it gives blank page. Display errors function is ON and I put try catch at the very begining, but it still shows a blank page. When ever I wri...

generate-migrations-diff failing with Zend framework

I am trying to generate a migration script using Doctrine with Zend Framework. I am getting the following: $ php doctrine.php generate-migrations-diff $ PHP Fatal error: Cannot redeclare class Avo_Model_AccessType in $ tmp/fromprfx_doctrine_tmp_dirs/AccessType.php on line 16 I can successfully build the models form the yaml file. ...

Zend framework group by

Hey folks! I'm trying to do a group by using Zend framework. Here's my code: $table = new TableClass(); $select = $table->select(); $select->from ("table", array("date", "column1" => "sum(column1)")); $select->group ( array ("date") ); $results = $table->fetchAll ($select); $result = $results[0]; $date = $result->date; $column1 = $resu...

Custom path for view scripts

I use customized paths for my application based on Zend Framework (a.k.a. themes). The view scripts are saved in public/themes/themename/modulename/..., so switching the application theme is just substituting themename in the path. How to tell Zend Tool to generate the view scripts in this directory instead of the default one? I suppos...

Magento Custom Modules (what they are and who can write them)

So everybody and their sister is now a "Magneto Expert" lol... It seems like many folks with such claims have (kind of) learned how to hack around and modify themes - and turn features in admin on and off - but do not really posses the skills to write- Magento Custom Modules. So what are Magento Custom Modules (in a physical sense)? I...

Zend Framework: lastInsertId is returning 0

I am currently learning Zend Framework from a book called "Appress Pro Zend Framework Techniques, Build a Full CMS Project" and I am stuck at a point where after submitting a bug, the page was suppose to redirect to confirm action, but this redirection depends on the result thrown by the Model, which saves the bug to the database. Here ...

Integrate Zend Framework With Legacy Application

Is it possible to integrate Zend Framework with already existing legacy web application? The application is written horribly using so called spaghetti code (no separation between presentation and application logic, PHP, HTML and SQL are all together). It is a very large application with hundreds of pages and forms. Does it make sense to...

What is the difference between $request->getControllerName() and $request->getParm("controller") when using _foward()

When using $this->_forward() in a Controller, in the resulting Controller the return for $request->getControllerName() returns the Controller Name from the first Controller. But when using $request->getParm("controller") it returns the correct Controller for the current Controller. Why are these different? ...

Extending Zend_View_Helper_FormElement

Hi, I have created this file at My/View/Helper/FormElement.php <?php abstract class My_View_Helper_FormElement extends Zend_View_Helper_FormElement { protected function _getInfo($name, $value = null, $attribs = null, $options = null, $listsep = null ) { $info = parent::_getInfo($name, $value, $attribs, $optio...

Zend Framework in sub directory

Hello, I would like to set up a Zend Framework project in a subdirectory: /public_html /public_html/here_i_want_to_setup_zf Document root is /public_html. I would like the Zend Framework project to be accessible via URI like this: http://example.com/here_i_want_to_setup_zf How should I edit my htaccess file? RewriteEngine On ...

Zend Application with Multiple login

Hi I want to have multiple login with in single zend application. I have five sections A,B,C,D,E and four type of users (P,Q,R,S) including anonymous user.These section have sub sections. Section A,B,C required login to access them. Section D and E can be accessed by all type of users but there are some action that can be followed by s...

How to call a view from a view in Zend Framework?

I need to render a view from inside a view. For the sake of question, i'll call them blocks. I have 5 controllers, each of them has an action that is called BlockAction(), and it displays some of the information from that controller. In the Index page for the whole website I need to call all 5 of those BlockAction views. What could be...

Doctrine Join DQL

I's like to do a join between 2 tables on a specific ID. At the moment, I have this DQL: $q = Doctrine_Query::create() ->select('e.*, i.itemName, i.itemtypeId') ->from('Model_EventItem e') ->leftJoin('Model_Item i ON e.itemId = i.itemId') ->where('e.eventitemId = ?', $event->eventId) ->orderB...