Re: [fw-general] AbstractRestfulController and HTML

2013-10-13 Thread Peter Warnock
David,

IMHO, XHR has become the predominant way for web apps to execute these 
additional methods in the browser.

If you really want the old behavior using a query param, it looks like you can 
attach a dispatch listener to the controller with a higher priority and set the 
action in the RouteMatch object.

Another approach would be to specify the action in child routes; the dispatch 
should fall back to the behavior of a standard action controller. 

- pw

On Oct 10, 2013, at 7:53 PM, David Muir  wrote:

> I'm just starting on a new project where I'm wanting to set up my routes to 
> work for HTML as well as JSON.
> 
> The AbstractRestfulController seemed like a good idea since it automatically 
> handles the routing of typical CRUD type actions. What I'm having trouble 
> with is how to deal with HTML's anaemic HTTP verb support. If I remember 
> correctly, in ZF1, you could send a request and include a METHOD query param 
> to route to the non supported verbs, e.g. PUT, DELETE, OPTIONS, HEAD, etc. 
> Looking through ZF2's AbstractRestfulController source and documentation, it 
> doesn't look like it supports that hack. Are people only using this 
> controller for json api's or is there an obvious way to handle it that I'm 
> missing?
> 
> Apigility looks really interesting, but I don't think it's the right fit 
> setting up the primary interface.
> 
> Cheers,
> David
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
> 
> 


--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] [ZF1] Error with Zend_Rest_Server when set a class that extends Zend_Db_Table

2013-02-11 Thread Peter Warnock
> This is the code to reproduce this error:
> 
>$this->server = new Zend_Rest_Server();
>$this->server->setClass("ClassName"); // Class "ClassName" will
> extends Zend_Db_Table

It's not a good idea to use Zend_Db_Table as a service layer; it's a data 
source pattern designed to keep SQL out of the application.  Create a service 
class that defines the API and encapsulates the business logic of the service 
you are designing.  
--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Mandrill Transport for Zend_Mail (ZF1 or ZF2)

2013-02-05 Thread Peter Warnock

> Just trying to see if anyone else has gone this route, or what the caveats 
> might be by using a transport that runs over Zend_Http_Client.

Take a look at https://github.com/juriansluiman/SlmMail

You might be able to fork it and contribute a Mandrill service.


--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Using Zend_Paginator with raw SQL

2011-07-08 Thread Peter Warnock

On Jul 8, 2011, at 6:02 AM, saiman wrote:

> Is there any way using Zend pagiantor with raw SQL query, not using
> Zend_Db_Select or Zend_Db_Table_Select. Sometimes I prefer not using
> those (Zend_Db_*) 


Create your own adapter that implements the interface.
http://framework.zend.com/manual/en/zend.paginator.advanced.html

Re: [fw-general] Service Layer, domain objects, mapers and approaches

2011-02-24 Thread Peter Warnock
On Feb 23, 2011, at 8:09 AM, Serkan Temizel wrote:
> 
> 
> More importantly I need your opinions about this approach. Why ZF don't ship
> with a service layer or default mapper? Are they really needed or they just
> increase the complexity?
> 

Once you understand the patterns, they actually decrease the complexity of the 
application.

http://martinfowler.com/eaaCatalog/
http://www.doctrine-project.org/projects/orm
http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215

Re: [fw-general] Zend_Form and custom validation workaround

2010-07-21 Thread Peter Warnock
Create subforms to take advantage of array notation and have the validator
compare the pair by naming convention. - pw

On Thu, Jul 1, 2010 at 10:00 AM, milesap  wrote:

>
> I have a problem that I cannot seem to wrap my head around.
>
> 3 text fields on my form are "start dates", and another 3 text fields are
> "end dates". I need to validate the end dates to their corresponding
> starting dates to ensure they are later than the start dates.
>
> I created a custom validator for this, but this won't work because the
> validator doesn't know which element called it, and therefore cannot use
> the
> $context variable to determine the start date. What can I do here apart
> from
> creating 3 of the same validators, one for each end date field?
>
> Sample form:
>
> Start date of Program => End Date of Program
> Early fee start date => Early fee end date
> Late fee start date => Late fee end date
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Form-and-custom-validation-workaround-tp2275449p2275449.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] Re: Zend_Rest_Client posted XML

2010-07-21 Thread Peter Warnock
Use Zend_Http_Client and call setRawData passing in an xml string.  You can
use DOMDocument or SimpleXML to create the string. - pw

On Sun, Jul 11, 2010 at 1:05 AM, rooboy  wrote:

>
> Hi Will.  Did you work out how to post the XML for insert/update
> operations?
> I am working on similar functionality.
> Thanks.
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Client-posted-XML-tp1592951p2285024.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] 301 redirects after changing routes

2010-07-21 Thread Peter Warnock
On Tue, Jul 20, 2010 at 5:51 PM, Саша Стаменковић 
> wrote:
> > $this->_redirect('/new-url', array('code' => 301));
>


> On Wed, Jul 21, 2010 at 7:54 PM, Jean-Michel Philippon-Nadeau <
> j...@jmpnadeau.ca> wrote:
>  I was hoping there were a config I could add to my routes.ini to catch
> requests made with an old URL scheme and forward them to the new ones.
> Or maybe a simple regex in my bootstrap would do the trick?
>
> Any ideas?
>
> You create a route that matches the old route and points to a redirect
action that uses the Redirector helper to redirect to the new route
http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.redirector


Re: [fw-general] subforms: flattening $form->getMessages in a DRY way

2010-02-08 Thread Peter Warnock
You might look at using a custom error decorator to adapt getMessages to
your need. - pw

On Mon, Feb 8, 2010 at 9:52 AM, David Mintz  wrote:

> I am using a Zend_Form containing Zend_Form_Subform instances, and
> submitting via jQuery/Ajax, using the AjaxContext helper on the controller
> side. When validation fails, I am sending a JSON data structure with the
> validation errors and using a crude jQuery plugin of my own devise that
> displays the errors where they belong. Works fine for simple (subformless)
> forms, but I discovered that where there are subforms, $form->getMessages()
> (naturally enough) groups the error messages under the subform name, while
> my jQuery plugin is expecting a flat array of validation error messages. I
> could make my plugin smarter, I guess, but it seems simpler to do the work
> server side. So, I am ensuring unique array keys by prepending the form name
> to each field name:
>
> $messages = $form->getMessages();
> $validationErrors = array();
> foreach (array_keys($messages) as $name) {
> foreach($messages[$name] as $k => $v) {
> $validationErrors["{$name}_{$k}"] = $v;
> }
> }
> $this->view->assign(array('validationErrors' =>
> $validationErrors));
>
> Seems to work fine. Any comments so far?
>
> But! This is going to happen in various places around the application, so I
> am considering the best approach. A controller action helper that mangles
> $form->getMessages() for me? Or have all my complex forms extend a base
> class that overrides getMessages()? Or... ?
>
> Thanks.
>
> --
> Support real health care reform:
> http://phimg.org/
>
> --
> David Mintz
> http://davidmintz.org/
>
>
>


Re: [fw-general] Router Help?

2009-11-02 Thread Peter Warnock
On Mon, Nov 2, 2009 at 6:36 AM, Tom Printy wrote:

Hello,
>
> I got my route to work however If  I add two routes to a controller only
> the last one added is evaluated. Is this the intended behavior?
>
>
Do your routes have unique names? - pw


Re: [fw-general] Zend_Form and arrays

2009-10-24 Thread Peter Warnock
2009/10/22 Krzysztof Szatanik 
>
> As you can see even if i get form values in request as i wanted, they
> aren't recognized by Zend_Form. Output of $form->getValues() is different
> from expected, and even fields aren't recognized, so i can use Zend_Form
> only to generate HTML form but not to filter and validate submited form.
>

Assuming it's a post:

$form->isValid($request->getPost());
$data = $form->getValues();

- pw


Re: [fw-general] Route chains not matching URLs with all optional variables

2009-10-24 Thread Peter Warnock
A chain is a single route made up of multiple routes. To achieve what you
want, add both the route and the chain to the router and test the route
method. - pw

On Thu, Oct 22, 2009 at 10:55 AM, Tim Fountain  wrote:

> I've having some trouble with route chains when the last route in the chain
> contains only optional variables. E.g. given these two example routes:
>
> $firstRoute = new Zend_Controller_Router_Route_Static('foo/bar');
> $secondRoute = new Zend_Controller_Router_Route(':action', array(
> 'module' => 'test',
> 'controller' => 'index',
> 'action' => 'index'
> ));
>
> $chain = new Zend_Controller_Router_Route_Chain();
> $chain->chain($firstRoute)
> ->chain($secondRoute);
>
>
> This:
>
> $request = new Zend_Controller_Router_ChainTest_Request('
> http://example.com/foo/bar/wibble' 
> );
> var_dump($chain->match($request));
>
> works as expected, however:
>
> $request = new Zend_Controller_Router_ChainTest_Request('
> http://example.com/foo/bar);
> var_dump($chain->match($request));
>
> outputs false, even though this is a perfectly valid route. Having looked
> at the route chain class, it seems that if it runs out of request before
> it's finished checking all the routes it just returns no match.
>
> Obviously my code above is a contrived example, as the two routes could
> easily be combined; but I have some custom route classes for hierarchical
> routing (/category/subcategory etc.) which would be difficult to merge.
>
> Is this worth opening an issue for, am I better off just creating my own
> route chain class, or am I misunderstanding how route chains are supposed to
> be used?
>
> --
> Tim Fountain
> http://tfountain.co.uk/
>


Re: [fw-general] How to make a global Zend_Log with Zend_Application_Bootstrap

2009-10-23 Thread Peter Warnock
On Sun, Oct 11, 2009 at 5:02 AM, Pádraic Brady wrote:

>
> You can initialise the Zend_Log instance from a method on the bootstrap
> called _initLog(), and return it from that method (essential). Then all you
> need to do from any action to get the object is
> $this->getInvokeArg('bootstrap')->getResource('Log'). If you need it in a
> Model, it depends how the Model works, where it is instantiated, etc. But
> generally you want to inject the Log into the Model through its constructor
> or a setter (assuming it's the same object you need!).
>
> Paddy
>

After sitting through the Dependency Injection Roundtable at ZendCon, I
completely agree.

- pw


Re: [fw-general] Zend_View adapters

2009-10-23 Thread Peter Warnock
On Fri, Oct 23, 2009 at 3:05 AM, umpirsky  wrote:

>
> So I wonder, are there any plans for implementing some adapterts for
> smarty,
> savant...? Or will twig adapter get it's place in zf some day?
>
> If yes, will they have all features which Zend_View has? Because it looks
> like Zend_View is a bit hard to customize.
>
> Zend_View can accommodate other template systems.

http://framework.zend.com/manual/en/zend.view.scripts.html#zend.view.scripts.templates

- pw


Re: [fw-general] Caching complex forms

2009-09-29 Thread Peter Warnock
I would only cache if it's visibly slow, or you're running out of memory. If
you're going to cache, cache the output since most of the overhead is used
in rendering. Keep in mind, you lose the ability to pre-populate the form.
- pw

On Mon, Sep 28, 2009 at 4:49 AM, holografix .  wrote:

>
> Hi
>
> I have several complex forms in the application and I would like to know if
> there is any benefit in caching those forms.
> If so, what would be the best way to go? Cache the classes or the output of
> the forms?
>
> Cheers
> holo
>


Re: [fw-general] How do you put Zend_Log into bootstrap correctly? - 2

2009-09-29 Thread Peter Warnock
In your example, the logger follows the return, which will never execute.
 The logger should be in a distinct _init method.
Clean up the tabs and get rid of the backslashes.

- pw

On Tue, Sep 29, 2009 at 11:38 AM, W Itch <
im.allergic.2.mailing.li...@gmail.com> wrote:

> How do you put Zend_Log into bootstrap correctly?  This code works fine by
> itself:
>
>
> Websites\akrabat\*application*\views\scripts\index\*edit.phtml* - This
> works!
>
> 
> $writer = new Zend_Log_Writer_Stream('../var/logs/log.txt'); // 
> Websites/akrabat/var/logs/
> $logger = new Zend_Log($writer);
> $logger->log('message to yoda', Zend_Log::EMERG);
>
> ?>
>
>
>
>
> But when I try to move it into the bootstrap instead then things break on
> my web application.  What's the proper to way to accomplish this?
> Here's some example codes:
> And I'm aware that neither zf_log.txt and log.txt is used entirely
> everywhere in the examples.
> It's remnants of various testing they aren't the problem and I'm using *
> log.txt* only on my LIVE version.
>
>
> *Edit view page*
> http://pastebin.com/m62377a84
>
> *Bootstrap file*
> http://pastebin.com/m763b14bd
>
>
>


Re: [fw-general] How to set either Zend_Form_Element_Text required?

2009-09-29 Thread Peter Warnock
A custom validator is probably the best way. You can also remove a validator
before you call isValid.
- pw

On Tue, Sep 29, 2009 at 9:48 PM, Leon_L  wrote:

>
> Hi, I'm new to Zend Framework, I have a question is that if I have two
> Zend_Form_Element_Text in a form, and I want make either of them to be
> filled by the user.
>
> For example, phone number and mobile number. People only need enter one of
> them to continue.
>
> How am I going to do this? Thanks
>
> --
> View this message in context:
> http://www.nabble.com/How-to-set-either-Zend_Form_Element_Text-required--tp25674976p25674976.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Zend_Db_Table Application Error

2009-09-13 Thread Peter Warnock
   1. Where's the error?
   2. You shouldn't use 'require' to load a class. Use the autoloader or
   'require_once'
   3. If you're using the autoloader, have you added the 'Default'
   namespace? Is your class in the application models/DbTable directory?

- pw

On Sun, Sep 13, 2009 at 6:22 AM, Stephen Alistoun  wrote:

>
> Hey all,
>
> In the module section where i have an extends Zend_Db_Table_Abstract it
> keeps on giving me a application error.
>
> When i take out the extends Zend_Db_table_Abstract it gives me no errors.
>
> So how do i go about getting no errors when extending the
> Zend_db_table_abstract.
>
> Thanks,
>
> Stephen
>
> /**Controller**/
>
> class IndexController extends Zend_Controller_Action
> {
>public function indexAction()
>{
>$users = new Default_Model_DbTable_UsersTable();
>}
> }
>
> /**Module***/
>
> require "Zend/Db/Table/Abstract.php";
>
> class Default_Model_DbTable_UsersTable extends Zend_Db_Table_Abstract
> {
>protected $_name = 'users';
> }
> --
> View this message in context:
> http://www.nabble.com/Zend_Db_Table-Application-Error-tp25423202p25423202.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Usage of ZFW / PHP in yuor country

2009-09-12 Thread Peter Warnock
If you want an unbiased answer, you're asking the wrong crowd. Of course it
is widely, well accepted to use Zend Framework in the enterprise ;)

- pw

On Sat, Sep 12, 2009 at 3:42 AM, howard chen  wrote:

> Hello,
>
> I am from Taiwan.
>
> In Taiwan, PHP is still not a main stream commerical programming
> language for web, people still prefer .NET or Java for web site
> development. (Althought most taiwan people prefer PHP opensource app
> such as wordpress, phpbb etc)
>
>
> Talking about PHP itself, most people still perfer programming with
> raw PHP - inline php codes with HTML. (not to mention ZFW)
>
>
> Is it the same in your contry?
>
> I heard that PHP is more popuar and well accepted in some western
> countries, even in the enterprise market, is it true?
>


Re: [fw-general] Zend_Validate_NotEmpty and null values

2009-09-12 Thread Peter Warnock
Based on your example, it looks like the backward compatibility was broken.

- pw

On Sat, Sep 12, 2009 at 7:20 AM, Martin Carpentier <
carpentier.mar...@gmail.com> wrote:

> Hi,
>
> I made a previous 
> postabout
>  this problem but never got any reply. I realize the title was probably
> a bit unclear.
> So here's my second attempt.
>
> Since ZF 1.9.x when you  try to validate a null value with
> Zend_Validate_NotEmpty you get the INVALID error message instead of the
> IS_EMPTY error message.
>
> If you try:
>
> $value = null;
> $validator = new Zend_Validate_NotEmpty();
>
> Zend_Debug::dump($validator->isValid($value));
> Zend_Debug::dump($validator->getErrors());
> Zend_Debug::dump($validator->getMessages());
>
> since ZF 1.9.x it results in:
>
> bool(false)
>
> array(1) {
>  [0] => string(15) "notEmptyInvalid"
> }
>
> array(1) {
>  ["notEmptyInvalid"] => string(76) "Invalid type given, value should be
> float, string, array, boolean or integer"
> }
>
> before ZF 1.9.x it would result in:
>
> bool(false)
>
> array(1) {
>  [0] => string(7) "isEmpty"
> }
>
> array(1) {
>  ["isEmpty"] => string(36) "Value is required and can't be empty"
> }
>
>
> I believe the expected behavior is to get the IS_EMPTY and not the INVALID
> error type.
>
> A fix for this would be to check that the value is not null before checking
> its type (in Zend/Validate/NotEmpty.php on line 56)
>
> if (null !== $value && !is_string($value) && !is_int($value) &&
> !is_float($value) && !is_bool($value) &&
> !is_array($value)) {
> $this->_error(self::INVALID);
> return false;
> }
>
> Could someone confirm this issue?
>
> Martin Carpentier
>


Re: [fw-general] How to get session namespace value

2009-09-12 Thread Peter Warnock
The init method is a good solution, but I had to take it one step farther
and register it in the Zend_Registry collection. I was using an action
helper and discovered that I had instantiated two different objects. While I
was adding data in the action, the action helper did not realize the
additions. By using the registry, both the action and action helper now
reference the same object.

- pw

On Sat, Sep 12, 2009 at 11:38 AM, Hector Virgen  wrote:

> I've found that it's easier to assign the session namespace object to a
> class property instead of instantiating it in each method. The init() method
> in Zend_Controller_Action is great for this. I also use a class constant for
> the namespace name just in case I need it in one of the other methods:
> class AuthController extends Zend_Controller_Action
> {
> const SESSION_NAMESPACE = 'userRegister';
>
> protected $_session;
>
> public function init()
> {
> $this->_session = new
> Zend_Session_Namespace(self::SESSION_NAMESPACE);
> }
> }
>
> Instead of testing if the namespace exists, you can now test if the
> property in the namespace exists:
>
> public function onregistersuccessAction()
> {
> if (!isset($this->_session->user)) {
> return $this->_helper->redirector('index');
> }
> /* ... */
> }
>
> I hope this helps :)
>
> --
> Hector
>
>
>
> On Sat, Sep 12, 2009 at 4:13 AM, whisher  wrote:
>
>> Hi.
>>
>> In the registerAction I set my namespace
>>
>> $userRegisterSession = new Zend_Session_Namespace('userRegister');
>> $userRegisterSession->user =  $data;
>> return  $this->_helper->redirector('onregistersuccess');;
>>
>> Than I need to retrieve the data so
>>
>> public function onregistersuccessAction()
>> {
>>if(!Zend_Session::namespaceIsset('userRegister')){
>>return $this->_helper->redirector('index');
>> }
>> 
>> $this->view->headTitle($this->translator->translate('user_Register_HeadTitle_onsuccess'));
>> $userRegisterSession = new Zend_Session_Namespace('userRegister');
>> var_dump($userRegisterSession->getIterator());
>>
>> }
>>
>>
>> As Zend_Session::_namespaceGet('userRegister') is deprecated, I don't find 
>> an other way.( Indeed, it's a very ugly way)
>>
>> I figure out there will be a more smart way.
>>
>> Can you give me an example ?
>>
>> Thanks in advance
>>
>> Bye
>>
>> --
>>
>> View this message in context: How to get session namespace value 
>> 
>>
>> Sent from the Zend Framework mailing list archive 
>>  at Nabble.com.
>>
>>
>


Re: [fw-general] Clarification needed about "Zend" and its products

2009-09-12 Thread Peter Warnock
I prefer Zend Framework because it has a large and active community,
corporate contributions from Google, IBM, Adobe, StrikeIron, et al, quick
iterations, and a solid object-oriented design patterns.

I was into Symfony until Fabien and Francois had their falling out.  Now it
seems like the project lacks clear leadership.

My biggest pet peeve with Cake, is its PHP4 compatibility.  I view this as a
roadblock, because it prevents using the latest capabilities and
optimizations.

The main requirement for Zend Framework is PHP 5.2. I've seen it used with
Nginx reverse-proxing to a back-end app server using FastCGI, which will
scale far better and ultimately out perform a standard LAMP stack. In that
example, the app server was running APC just fine.  Opcode cachers are not a
part of the framework. They are a part of the server environment.

Zend_Cache is most useful at decreasing the number of function calls in the
execution of a script.  You can cache the entire frontend, or specific
components, like database calls where the data doesn't change frequently.
You can select different cache backends like File, APC, MemCache, etc. to
store the output.

Zend Optimizer is really an encoder (
http://www.ducea.com/2006/10/30/php-accelerators/). It more or less defeats
the purpose of open-source.

When you find out of date documentation, the best thing you can do is get
involved in the community.

I hope you stick around. - pw


On Sat, Sep 12, 2009 at 7:55 AM, ataulkarim  wrote:

>
> I must admit in the beginning i'm somewhat new to Frameworks, but for
> reasons
> to move to enterprise development and faster project execution im prone to
> get into the Frameworks Arena. Now, i have to make a choice between certain
> frameworks - Zend Framework, CakePHP, Symfony, CodeIgniter etc. I've
> invested quite a bit of time for each one's pros n cons, but i could not
> find an article or tutorial that gives me a complete insight into the world
> of "Frameworks".
>
> I've decided to approach the Zend Community to clarify me some of the
> things
> that are going on in my head. I hope many would like to participate here so
> that each new beginner can get an idea what options he has. Now, with all
> the backing that Zend has in terms of Technology Partners, people with
> PHP-Core knowledge, i decided to learn Zend framework, although alot of
> friends told me to choose CakePHP.
>
> Zend has:
>
> 1. Zend Framework 1.9.2 (Free)
> 2. Zend Server Community Edition (Free)
> 3. Zend Server (Buy)
>
> I've seen MVC tutorials of the framework (although old ones), but find the
> concept appealing. Zend server Community Edition provides with an user
> interface to work with, great. The only thing that confuses me is the
> aspect
> of CACHING.
>
> Caching
>
> Zend framework and Zend Community Edition come with the Zend Optimzer(to my
> understanding does not do opcode caching) and the Zend Server provides with
> opcode caching. I've read alot of APC caching possibilities and capabilites
> which to some people is faster then Zend Optimzer. Andi Gutmans commented
> somewhere that Zend Server has opcode caching capabilities and performance
> tests should be done with zend server.
>
> Now, here are my questions:
>
> 1. If i install Zend Server Community Edition can i still make certain
> manual changes i would be able to do with Zend Framework?
>
> 2. Are opcode caching capabilites present in Zend Framework / Zend Server
> CE
> - other than Optimizer? (if not -> Can i use zend framework to manually
> overcome this deficit?)
>
> 3. If the only Opcode caching is possible with Zend Server(which i would
> have to buy)- is there a possibility to integrate APC with Zend Framework?
>
> 4. Why does Zend has a  http://framework.zend.com/docs/screencasts
> Screenacst Tutorial  about "Getting Started with Zend Framework" with
> 1.0.3.
> Ok i know Zend is a 'Company' and would concentrate more on the buy side of
> products, but essence of PHP is i guess Open Source(free) and any help
> regarding that would be appreciated even if its in the getting started
> video
> - 1.8 would also be OK :-) .
>
> I hope i get some clarification for these questions which might also
> benefit
> others.
>
> Thanx,
> Ataulkarim
> --
> View this message in context:
> http://www.nabble.com/Clarification-needed-about-%22Zend%22-and-its-products-tp25415258p25415258.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Correct model use to gather data from multiple tables

2009-09-12 Thread Peter Warnock
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.fetching.dependent

On Sat, Sep 12, 2009 at 6:31 PM, Er Galvao Abbott wrote:

>  Greetings.
>
> I have this basic question for quite some time now and it's incredibly hard
> to find examples that explain this. I guess it's pretty self explanatory,
> but here we go:
>
> If I need to gather data from a database table I create a model, a data
> gateway and a mapper, and then I just use a method like fetchAll which
> executes the desired query ('select foo from bar' or something like that).
>
> My question is, what if I need to gather data from multiple tables? Let's
> say I have a users table and a group table. If I need to get details from a
> user I'd use a method such as find from the user data gateway, but what if I
> need to pull data from the user and group tables? You know, something like:
>
> SELECT u.email, g.name FROM users u, groups g WHERE u.group_id = g.id
>
> Of course, I could just "cheat" and create a method in the user data
> gateway which retrieves everything, but since I'm retrieving data from a
> table other than the user's wouldn't that be wrong?
> Hope I've made myself clear.
>
> Cheers,
>
> Galvao
> http://www.galvao.eti.br/
>


Re: [fw-general] Using Zend keeping url intact

2009-09-06 Thread Peter Warnock
route = "(.+)(?:\.php)?"

On Tue, Sep 1, 2009 at 5:20 AM, Naimesh.Trivedi (Gmail) <
naimesh.triv...@gmail.com> wrote:

>  Hello !
>
>
>
> Can anybody help me telling, how to keep the URL intact for the working
> websites but still to convert them in Zend Framework 1.9. The old sites URLs
> are like
>
>
>
> http://www.abc.com/index.php
>
> http://www.abc.com/abc.php?id=23
>
>
>
>
>
> Please help me on this with some example.
>
>
>
> Thanks in Advance !
>
>
>
> Nbt
>
>
>
>
>


Re: [fw-general] Using Zend Layout for module not main application

2009-09-05 Thread Peter Warnock
In a 1-off scenario, I prefer method 3. No config necessary.

Zend_Layout::startMvc();

$this->_helper->layout->setLayout('foobaz');

 - pw

On Fri, Sep 4, 2009 at 10:02 AM, Matthew Lurz  wrote:

>
> A couple of additional ways...
>
> 3) Add the layout setup code to the controller init method.
>
> 4) If you find yourself having to do the above a lot, create an action
> helper with the layout setup code which you would then call in the
> controller init method or wherever you need it.
>
> Just wanted to throw those out there though if it were me I think I would
> prefer 1 or 2. The ZF is very flexible and will bend to your will!!
>
>
> sagittariidae wrote:
> >
> > Is it possible to have Zend Layout work only for a module whilst the main
> > application does not use Zend Layout?
> >
> > The problem I am facing is that an already existing application that uses
> > Zend Layout now needs to reside as a module in another application that
> > does not use Zend Layout and instead uses a Zend View/Smarty hybrid.
> >
> > If it is possible would I need to set it up in the main application
> config
> > (.ini) file or would i need to use a module specific config file?
> >
> > Any help would be much appreciated.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Using-Zend-Layout-for-module-not-main-application-tp25291667p25298169.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] 8 custom routers ... should I worry about performance ?

2009-08-13 Thread Peter Warnock
On Thu, Aug 13, 2009 at 1:32 AM, debussy007  wrote:

>
> In that case one must update the doc:
> *
> The following route more-or-less mimics the Module route behavior:
> $route = new Zend_Controller_Router_Route(
>':module/:controller/:action/*',
>array('module' => 'default')
> );
> $router->addRoute('default', $route);
> *
> this will not match /services/web-development (using the default module)
> for
> example
> :module will be services and :controller will be web-development
>

Actually, that route would not catch.  The action has not been defined.
Just drop module from the route and it will map services to the controller
and web-development to the action.

- pw


Re: [fw-general] Zend_Form - Adding CSS classnames to multiCheckbox inputs

2009-08-13 Thread Peter Warnock
On Tue, Aug 11, 2009 at 11:07 AM, Hector Virgen  wrote:

>
>
> I am building a form that uses the multiCheckbox form element. I need to
> add class names to specific checkboxes for javascript purposes. Is there a
> way to do that?
>
> --
> Hector
>

Why not navigate the dom with javascript? jQuery makes this very easy. - pw


Re: [fw-general] Zend Framework 2.0

2009-08-12 Thread Peter Warnock
Rackspace supports a custom build of 5.2 on RHEL.

On Aug 11, 2009 10:39 AM, "Michael Kimsal"  wrote:

While distro/php versions probably will always be a factor to some degree,
putting too much weight on that as a deciding factor will lead to
stagnation.  RHEL and CentOS, arguably the most 'enterprise' of Linux
distros, still only officially support PHP 5.1.6, IIRC.  Yes, you can
upgrade from other repos, but I think you lose whatever 'enterprise support'
you might get (probably not as much of a concern for the CentOS users).

On Tue, Aug 11, 2009 at 1:26 PM, Mario Guenterberg <
mario.guenterb...@googlemail.com> wrote: > > ...
-- 
Michael Kimsal
http://jsmag.com - for javascript developers
http://groovymag.com - for groovy developers
919.827.4724


Re: [fw-general] Zend_Session Garbage Collections Works?

2009-08-10 Thread Peter Warnock
On Mon, Aug 10, 2009 at 11:20 AM, Alex  wrote:

>
> As an aside: would using the DbTable save handler be more efficient than
> the file handler?
>
> - Alex
>

The file handler is faster, but the db handler can provide persistence
across multiple servers and is potentially more secure depending on the
hosting environment. - pw


Re: [fw-general] Best way to have custom URL's for each web page ?

2009-08-08 Thread Peter Warnock
You can create a custom route implementing the interface, or create a
plugin, or use a forward after the lookup from the default action. - pw

On Aug 8, 2009 12:08 PM, "debussy007"  wrote:


Hi,

I'm building a CMS and I want to allow the users to configure for each page
and language a personnalized URL.

E.g. rename   http://example.com/services/list   to:
in French http://example.com/nos-services
in Dutch http://example.com/onze-diensten
etc.

So I would have all these URL's in DB and linked to a specific action I
guess.

But then when my bootstrap gets the request  http://example.com/nos-services
How do I forward to the correct module/controller/action and set the correct
locale ?

I'm quite lost on this, can anyone help ?
Thank you!
--
View this message in context:
http://www.nabble.com/Best-way-to-have-custom-URL%27s-for-each-web-page---tp24878049p24878049.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] routing question (hostname chain)

2009-08-04 Thread Peter Warnock
2009/8/3 Vladas Diržys 

>
> The problem is then I do such like this:
> $hostRoute->chain($pathRoute); -- only one hostname can be routed.
>

You should have two hostname routes with paths chained to them.  The
hostname routes will define your modules, while the paths define the
controllers.

- pw


[fw-general] form.elementFilters conflicts with form.elements.options.filters

2009-08-04 Thread Peter Warnock
If I try to run these two filters, only trim works:
form.elementFilters.trim = "StringTrim"
form.elements.phone.options.filters.digits = "Digits"

If I comment out trim, the digits filter works:
;form.elementFilters.trim = "StringTrim"
form.elements.phone.options.filters.digits = "Digits"

Without resorting to code, is there another way to implement both or do I
need to overload a custom element?

- pw


Re: [fw-general] How render Zend_Form to html table?

2009-08-01 Thread Peter Warnock
You can create a custom decorator or access the elements as properties. - pw

On Aug 1, 2009 8:23 AM, "Mark Maynereid"  wrote:


I've heard this about tables to be avoided in forms, but then how do I mimic
SquirrelMail's message list approach (see image below) where I want a table
of some data primarily, but, also with check boxes for each line and a then
selection of buttons at the top of the page to offer different actions on
the checked items?

I really like this UI style but not sure if I should do it manually or try
to employ Zend_Form here?  I'd kind of like to use Zend_Form for consistency
with my other Zend_Form usage but only if it makes sense to.

Any help ideas appreciated.

Regards,

Mark

http://www.nabble.com/file/p24770053/messagelist.jpg


DASPRiD wrote:
>
>
> Yeah also, you should not make forms with tables ;)
>
> Matthew Weier O'Phinney schrieb:
>

--
View this message in context:
http://www.nabble.com/How-render-Zend_Form-to-html-table--tp15299082p24770053.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Seperate action to proccess a form

2009-07-26 Thread Peter Warnock
On Sun, Jul 26, 2009 at 8:36 PM, aSecondWill  wrote:

> If the form dosn't validate, how do i display the original page, with the
> form errors etc.


_forward back to the original action and make sure you are accessing the
same instance of the form object, it contains the error stack after calling
isValid. - pw


Re: [fw-general] hosting suggestions with support for ZF

2009-07-25 Thread Peter Warnock
Explicit Zend Framework support is probably the least important requirement
since its very portable.  Look for a host that has good up-time, responsive
support, and can scale.

You can overcome some of the latency issues by using a content delivery
network (CDN) to host your static assets.

I don't have a specific recommendation, but I did get Zend_Application
running on DreamHost for less than $2/mo
http://www.dreamhost-promo-code.net/dreamhost-coupon.html

- pw


Re: [fw-general] namespace persistence

2009-07-24 Thread Peter Warnock
On Fri, Jul 24, 2009 at 4:24 PM, hacheb  wrote:

>
> What I want, however, is to keep the second namespace. In effect, only the
> zend_auth namespace should be unset (ie. removed from the data column)
> whilst the other would remain untouched.
>


I viewed the source for Zend/Session/Namespace.php and found  a method
called unsetAll which unsets the namespace.

$oNamespacedSession->unsetAll();

- pw


Re: [fw-general] params problem

2009-07-23 Thread Peter Warnock
You have a hyphen in the request param and an underscore in the arg passed
to forward - pw

On Jul 23, 2009 2:16 AM, "debussy007"  wrote:


Hello,

I was expecting that if I forward to another action, the parameters
specified in the forward() method would override params with same name of
the request, let me clarify with the simple example below:

function deleteModuleAction() {
   $moduleId = $this->_getParam('p-module'); // 2
   return $this->_forward('setup-module', NULL, NULL, array('p_module'
=> 1));
// set the param to 1
}

function setupModuleAction() {
   $module = $this->_getParam('p-module'); // 2
   $this->logger->debug($module); // print 2
}
--
View this message in context:
http://www.nabble.com/params-problem-tp24622110p24622110.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Models as Singletons

2009-07-21 Thread Peter Warnock
On Tue, Jul 21, 2009 at 10:53 AM, Marko Korhonen <
marko.korho...@datafisher.com> wrote:

>
> Thanks fo everybody for the great comments!
>
> I decided to change my getInstance() method so it just
> created new instance of the class and returns it (giving up on singleton
> on this case).
>
> So if I have static call:
> $model = Comment_Model_Comment::getInstance();
> it's the same if I would write:
> $model = new Comment_Model_Comment();
>
> Only difference being that I can call directly some methods like:
> $comments = Comment_Model_Comment::getInstance()->getAll();
>
> Any considerations to this one?
>
> getInstance implies it is a Singleton. You are describing a factory method.

- pw