Re: [fw-general] ZF application optimizations (and speedup)

2008-11-06 Thread Michael Depetrillo
Mathew

Does using autoload improve or reduce performance?
I thought I saw an email by you where you stated in did.

Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
Fax: (858) 430-2706


On Thu, Nov 6, 2008 at 6:28 PM, Matthew Weier O'Phinney <[EMAIL 
PROTECTED]>wrote:

> -- Sander van de Graaf <[EMAIL PROTECTED]> wrote
> (on Friday, 07 November 2008, 01:36 AM +0100):
> > Hi all,
> >
> > Just wanted to point you to a blog post about some optimizations I found
> > for a ZF project we're finishing up. It might be of interest to some of
> > you:
> >
> > http://www.svdgraaf.nl/2008/11/07/optimizing-your-zf-web-application/
> >
> > If you have any comments, please let me know.
>
> You have some interesting points about tuning the server and using CDNs
> that many people overlook when they consider optimizing their *site*,
> not just the applications.
>
> I also want to announce that I've been working on a performance guide
> appendix to the manual, and those of you following the subversion
> commits have likely noticed these commits. I have a lot of detail on
> ways you can reduce things like class loading overhead, how to optimize
> your views, etc. More tips will be added in the coming week as we
> approach the 1.7.0 release.
>
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
>


[fw-general] Zend_Filter classes turn NULL values into empty strings

2008-11-06 Thread Grotevant, Paul F
I'm developing a Zend_Form class which will feed data into a MySQL table
through a Zend_Db table class.

There are a number of fields on this form that are optional, and which I
want to default to NULL in the database if they are not filled in. However,
I was finding that the empty values from the form were being inserted into
the db table as empty strings, rather than NULLs (this was true even if
those fields were disabled, meaning that there were no values for them in
the POST data -- $form->getValues() returns zero-length strings rather than
NULLs).

After some head-scratching, I realized that it was the StringTrim and
HtmlEntities filters that were turning those fields into zero-length
strings, which by turn get inserted into the db table as zero-length strings
instead of NULL.

I can take the filters off of those form elements and get the desired result
in my database, but that leaves me with a form that's potentially vulnerable
to cross-site scripting attacks.

Any thoughts?

Thanks,
Paul


-- 
Paul Grotevant / Web Technologies Team
ITS Applications / University of Texas at Austin
[EMAIL PROTECTED]
512-471-1616


smime.p7s
Description: S/MIME cryptographic signature


Re: [fw-general] Zend_Db_Table_Rowset seek() question

2008-11-06 Thread Cameron
I built something like this as a paginator for when you're on your item
view. What I did was build a simple class that implements the SPL Iterator
and Countable classes, just like the internal Zend_Paginator, but just uses
an array as its internal guts. Then I simply grabbed all the id fields from
my table and passed it as an array through to my paginator class'
constructor, and then called the setCurrentItem method to correctly position
the pointer in array. I have no idea if something like this helps you at
all, but it seemed a pretty clean way of solving my particular problem,
which was getting a "next" and "previous" button on my record display.
Here's the class anyway, if it helps.

class ItemPaginator implements Countable, Iterator
{
protected $collection;
protected $count;
protected $pointer_position;

public function __construct( $collection ) {
  $this->collection = $collection;
  $this->count = sizeof($this->collection);
}

public function count() {
return $this->count;
}

public function key() {
  return $this->pointer_position;
}

public function current() {
  return $this->collection[$this->pointer_position];
}

public function next() {
  $this->pointer_position++;
}

public function rewind() {
  $this->pointer_position = 0;
}

public function valid() {
  return strlen( $this->collection ) > $this->pointer_position;
}

public function getNextItem() {
if ($this->pointer_position < $this->count) {
return $this->collection[$this->pointer_position + 1];
}
return false;
}

public function getPrevItem() {
if ($this->pointer_position > 0 ) {
return $this->collection[$this->pointer_position - 1];
}
return false;
}

public function getFirstItem() {
if ($this->pointer_position > 0 ) {
return $this->collection[0];
}
return false;
}

public function getLastItem() {
if ($this->pointer_position < $this->count ) {
return $this->collection[$this->count - 1]; // -1 for the array
offset
}
return false;
}

public function setCurrentItem($item) {
$key = array_search($item, $this->collection);
if (FALSE !== $key) {
$this->pointer_position = $key;
return true;
}
return false;
}
}


Sorry if this is really terrible code that I should be implementing
completely differently, the SPL is all a bit new to me :)



On Fri, Nov 7, 2008 at 1:17 AM, Jason Austin <[EMAIL PROTECTED]> wrote:

> I have a need to paginate some simple results, which I need the count of
> the entire rowset, and then rows from a particular offset.  I don't really
> want to execute 2 queries, so I was thinking of using the seek() method of
> my result set to put the pointer to the required offset, however when I loop
> through the results it starts over at the beginning of the result set:
>
> 
> $rows = $model->fetchAll($where, $order);
>
> $rows->seek($page * $resultsPerPage);
>
> echo $rows->current()->id  // echoes correct "seek()" offset ID
>
> foreach ($rows as $r) {  // starts over at the beginning of the rowset
>   // add to result set
> }
>
> ?>
>
> Is this the expected behavior or am I missing something totally obvious?
>  This is with version 1.6.1.  Should I just do 2 queries (a query to get
> the required rows, then a count query without qualifier)?
>
> Thanks!
> Jason
>
> --
> Jason Austin
> Senior Solutions Implementation Engineer
> NC State University - Office of Information Technology
> http://webapps.ncsu.edu
> 919.513-4372
>
>


[fw-general] Zend Form populate method doesn't support FilteringSelect / ComboBoxes using a Dojo datastore.

2008-11-06 Thread Cameron
Hi guys,

I've got some form elements built using Dojo data stores, basically like
this:

$this->addElement('FilteringSelect', 'client_id', array(
'label'=> 'Client:',
'store'  => 'clientStore',
'autoComplete'   => 'false',
'hasDownArrow'   => 'true',
'id' => 'client_id',
));

with



on the form page. But when I call $form->populate in the edit controller, it
is populating the value correctly (as confirmed by
print_r($this->form->getValues()) in the edit view), but the select isn't
displaying anything.

I'm assuming this is happening because the options aren't being generated
until after the first attempt to type something in to the select or click on
the down arrow, so I've tried adding an extra default option to fill out the
drop down while it's waiting for someone to click on something by going:

$form->getElement('client_id')->addMultiOption($id, $value);

in the controller, but it's no go. Doesn't work. The only other idea I've
got is somehow triggering the form to fill the dropdown list with JS when it
first loads, but I haven't found any documentation on such features, so I'm
basically shooting in the dark with it. So has anyone else solved this
issue? Or am I doing something wrong / missing the obvious?


Re: [fw-general] Zend_Db

2008-11-06 Thread Matthew Weier O'Phinney
-- DorkFest <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 05:58 PM -0800):
> This was posted in Dec 2007. I have the same question. Is there anyway using
> fetchAll and setFetchMode to set the explicit class name that's returned in
> the array?
> 
> Or is this a design conflict? Here's basically the situation:
> 
> class Articles extends Zend_Db_Table_Abstract 
> {
>   protected $_name = "articles";
>   protected $_rowClass = "Article";
>   
>   public function fetchActive()
>   {
>   $db = Zend_Registry::get('db');
>   $db->setFetchMode(Zend_Db::FETCH_OBJ);
>   $select = $db->select()
>   ->from($this->_name)
>   ->where('active = 1')
>   ->order('creation_date DESC');
>   // want to return array of articles objects here instead of 
> stdClass
>   return $db->fetchAll($select);
>   }
> }
> 
> class Article extends Zend_Db_Table_Row_Abstract
> {
> }
> 
> Is this the wrong way to approach models? Or is there a better way to obtain
> the fetchAll array of Articles as a return value from the fetchActive()
> method.

Umm... wow... that code is.. wow.

First, when you have a Zend_Db_Table object, you already *have* the
database adapter -- there's no need to grab it from the registry. Next,
Zend_Db_Table also has its own select object now (since 1.5) that
obviates the need to (a) pull it from the database adapter, and (b)
specify the table name (it's automatically populated). Next, fetchAll()
on the adapter already returns an array by default -- it has from the
very beginning. You actually have to override this behavior to get a
different return type by passing the fetchmode as the second parameter to
the call. The reason you're getting anything different is because your
code is calling:

$db->setFetchMode(Zend_Db::FETCH_OBJ);

which tells the adapter to return fetch results as objects. You're
basically shooting yourself in the foot here.

So, the following will do what you're trying to accomplish:

public function fetchActive()
{
$select = $this->select()
   ->where('active = 1')
   ->order('creation_date DESC');
return $this->getAdapter()->fetchAll($select);
}


> Renan Gonçalves wrote:
> > 
> > Hello,
> > 
> > How I can use fetchAll with fethMode = Object and using the class Article
> > (for example) ?
> > I can use fetchObject('Article') and will fetch on my class, but in
> > fetchAll
> > the default class is stdClass.
> > 
> > The PDOStatement has the function: (
> > http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php)
> > bool *setFetchMode* ( int $PDO::FETCH_CLASS , string $classname , array
> > $ctorargs )
> > 
> > 
> > Best Regards,
> > -- 
> > Renan Gonçalves - Web Developer
> > Cell Phone: +55 (11) 8633-6018
> > MSN: [EMAIL PROTECTED]
> > Web Site: renangoncalves.com
> > São Paulo - SP/Brazil
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Zend_Db-tp14140524p20373369.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] ZF application optimizations (and speedup)

2008-11-06 Thread Matthew Weier O'Phinney
-- Sander van de Graaf <[EMAIL PROTECTED]> wrote
(on Friday, 07 November 2008, 01:36 AM +0100):
> Hi all,
>
> Just wanted to point you to a blog post about some optimizations I found 
> for a ZF project we're finishing up. It might be of interest to some of 
> you:
>
> http://www.svdgraaf.nl/2008/11/07/optimizing-your-zf-web-application/
>
> If you have any comments, please let me know.

You have some interesting points about tuning the server and using CDNs
that many people overlook when they consider optimizing their *site*,
not just the applications.

I also want to announce that I've been working on a performance guide
appendix to the manual, and those of you following the subversion
commits have likely noticed these commits. I have a lot of detail on
ways you can reduce things like class loading overhead, how to optimize
your views, etc. More tips will be added in the coming week as we
approach the 1.7.0 release.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend_Db

2008-11-06 Thread till
On Fri, Nov 7, 2008 at 2:58 AM, DorkFest <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> This was posted in Dec 2007. I have the same question. Is there anyway using
> fetchAll and setFetchMode to set the explicit class name that's returned in
> the array?
>
> Or is this a design conflict? Here's basically the situation:
>
> class Articles extends Zend_Db_Table_Abstract
> {
>protected $_name = "articles";
>protected $_rowClass = "Article";
>
>public function fetchActive()
>{
>$db = Zend_Registry::get('db');
>$db->setFetchMode(Zend_Db::FETCH_OBJ);
>$select = $db->select()
>->from($this->_name)
>->where('active = 1')
>->order('creation_date DESC');
>// want to return array of articles objects here instead of 
> stdClass
>return $db->fetchAll($select);
>}
> }
>
> class Article extends Zend_Db_Table_Row_Abstract
> {
> }
>
> Is this the wrong way to approach models? Or is there a better way to obtain
> the fetchAll array of Articles as a return value from the fetchActive()
> method.

Looks wrong. You are duplicating your effort.

First off, in your bootstrap you can define a Zend_Db object and do
"setFetchMode()" on it. Then you chain it to your
Zend_Db_Table_Abstract extending classes with
Zend_Db_Table_Abstract::setDefaultAdapter(). I think by default
Zend_Db_Table_Abstract will also use a 'db' object saved in your
registry. So there might not be a need to use setDefaultAdapter().

Inside a model (model_Foo extends Zend_Db_Table_Abstract {}), use:

$db = $this->getAdapter();

That is, if you really need a DB object and $this->select(),
$this->fetchAll(), $this->update(), $this->delete(), $this->insert(),
etc. are not enough.

Also, the framework is growing fast. Don't use tutorials from a year
ago when you start now. Use the manual instead:

http://framework.zend.com/manual/en/zend.db.table.html

Till


Re: [fw-general] Zend_Db

2008-11-06 Thread DorkFest

Hi,

This was posted in Dec 2007. I have the same question. Is there anyway using
fetchAll and setFetchMode to set the explicit class name that's returned in
the array?

Or is this a design conflict? Here's basically the situation:

class Articles extends Zend_Db_Table_Abstract 
{
protected $_name = "articles";
protected $_rowClass = "Article";

public function fetchActive()
{
$db = Zend_Registry::get('db');
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$select = $db->select()
->from($this->_name)
->where('active = 1')
->order('creation_date DESC');
// want to return array of articles objects here instead of 
stdClass
return $db->fetchAll($select);
}
}

class Article extends Zend_Db_Table_Row_Abstract
{
}

Is this the wrong way to approach models? Or is there a better way to obtain
the fetchAll array of Articles as a return value from the fetchActive()
method.

Thanks very much!


Renan Gonçalves wrote:
> 
> Hello,
> 
> How I can use fetchAll with fethMode = Object and using the class Article
> (for example) ?
> I can use fetchObject('Article') and will fetch on my class, but in
> fetchAll
> the default class is stdClass.
> 
> The PDOStatement has the function: (
> http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php)
> bool *setFetchMode* ( int $PDO::FETCH_CLASS , string $classname , array
> $ctorargs )
> 
> 
> Best Regards,
> -- 
> Renan Gonçalves - Web Developer
> Cell Phone: +55 (11) 8633-6018
> MSN: [EMAIL PROTECTED]
> Web Site: renangoncalves.com
> São Paulo - SP/Brazil
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Db-tp14140524p20373369.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] ZF application optimizations (and speedup)

2008-11-06 Thread Sander van de Graaf

Hi all,

Just wanted to point you to a blog post about some optimizations I  
found for a ZF project we're finishing up. It might be of interest to  
some of you:


http://www.svdgraaf.nl/2008/11/07/optimizing-your-zf-web-application/

If you have any comments, please let me know.

cheers,
Sander


Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Ionut Gabriel Stan

Vince42 wrote:

Hi,

Ionut Gabriel Stan schrieb:
   

Thanks Robert, I had no idea there's an option for a hierarchical
view. I Should have played more with PDT before complaining about
this.
 


Let's face it: This option is *very well hidden* ... it should rather
reside in the context menu of the explorer or in a View menu, like in
other applications ...

   

Here's an alternative way to reach the same thing:

http://www.sitepoint.com/forums/showthread.php?t=581309

I believe this is a standard place for such options on the Eclipse platform.
It doesn't matter that much if it's hidden or not. Thank God is there.



Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Vince42
Hi,

Ionut Gabriel Stan schrieb:
> Thanks Robert, I had no idea there's an option for a hierarchical
> view. I Should have played more with PDT before complaining about
> this.

Let's face it: This option is *very well hidden* ... it should rather
reside in the context menu of the explorer or in a View menu, like in
other applications ...

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Ionut Gabriel Stan

Thanks Robert, I had no idea there's an option for a hierarchical view.
I Should have played more with PDT before complaining about this.

Cheers,
Ionut


Robert Castley wrote:


When in the PHP explorer do the following:

Window -> Navigation -> Show View Menu

Package Presentation -> Hierachical

- Robert


-Original Message-
From: Vince42 [mailto:[EMAIL PROTECTED]
Sent: Thu 06/11/2008 12:06
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

Ionut Gabriel Stan schrieb:
> The representation of folders inside PHP Explorer view is driving me 
crazy.

> It should be a tree like structure...

Yes, but I guess there's some setting, which allows to toggle these view
modes, as this folder view consumes to much spaces while providing
irrelevant information and the view is now lacking overview ... just my
two cents ...

--
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


This email has been scanned for all known viruses by the MessageLabs 
Email Security Service and the Macro 4 plc internal virus protection 
system.






This email has been scanned for all known viruses by the MessageLabs 
Email Security Service and the Macro 4 plc internal virus protection 
system.






Re: [fw-general] RE: [zf-contributors] Re: [fw-general] Re: [zf-contributors] Zend Framework SVN Commit Proposal

2008-11-06 Thread Rob Allen


On 6 Nov 2008, at 18:53, Wil Sinclair wrote:



Long gone are the days that JIRA was down for hours at a time, and  
they

aren't going to come back.



The scars from then take time to heal!


Regards,

Rob...



Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Rob Allen


On 6 Nov 2008, at 14:12, Matthew Weier O'Phinney wrote:


Ah, right. But Zend_Db_Table itself does not have it. (I typically  
don't

use the row objects -- probably should).


You should :) RDGs are very handy when using TDGs !

Right -- and Zend_Db_Table::insert() and update() also throw  
exceptions

if you attempt to save a key that does not resolve to a field. I
personally feel we should have a flag allowing these methods to ignore
unknown keys -- it would make saving data to multiple tables much
easier.


I agree!  It would be useful in a number of scenarios. I couldn't see  
an issue for it so I've created ZF-4837.



Regards,

Rob...





[fw-general] RE: [zf-contributors] Re: [fw-general] Re: [zf-contributors] Zend Framework SVN Commit Proposal

2008-11-06 Thread Wil Sinclair
I'm not sure why you guys are asserting that JIRA has regular problems
that would affect the web service API somehow. There was a recent
problem with a few users not getting recognized in JIRA that I solved a
few days ago. The only times that it has been down in the last few
months is are the few times I've taken it down for a 5 minutes or so to
test a fix for the problem above. At worst, you'd just have to wait a
few minutes to try your commit in this case.
Long gone are the days that JIRA was down for hours at a time, and they
aren't going to come back. That said, this seems like a pretty strict
commit hook, and I can't promise that there will never be issues with
JIRA that might make such a commit hook fail on a good commit.

,Wil


From: Christoph Dorn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2008 11:17 AM
To: Ralph Schindler
Cc: Matthew Ratzloff; Zend Framework - General;
[EMAIL PROTECTED]
Subject: [zf-contributors] Re: [fw-general] Re: [zf-contributors] Zend
Framework SVN Commit Proposal



Might want to make the ticket expression /ZF\-\d+/ just to make
maintenance of
the hook easier.  You'll also want to prevent commits to tickets that
are
closed.


That would require a JIRA lookup, which means Jira would have to be
running
100% of the time and without load.  Not sure that requirement can be met
at
this time but we are getting there.
  
You could implement a separate lookup table that gets updated every time
a ticket status changes using the same interface the IRC bot uses. This
would decouple the SVN hook from JIRA which is important as JIRA seems
to have regular problems. I think the lookup table will stay mostly in
sync if the notification interface is reliable, but that would have to
be tested.

Christoph



RE: [fw-general] Layout assign function... (temp fix)

2008-11-06 Thread Terre Porter
After digging around in all the classes that referred and such I found no
use of the stored variables (_container) from the layout.php file..

So, I modified the render function in layout.php for a quick and dirty
test..

...
$view = $this->getView();

// quick and dirty assign stored vars to view
foreach ($this->_container as $k => $v) {
$view->$k = $v;
  } 
...

This passes the variables stored in the _container, from assign and _set
function, in to the layout's view ... 

The variables did get assigned to the layout view and the page returned no
errors.

I'll leave this patch my code so that I can continue programming on my
project ...

Any thoughts on this problem ?

Terre

-Original Message-
From: Terre Porter [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 06, 2008 12:12 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Layout assign function...

Hello,
 
I've got myself a bit confused, maybe someone can clarify this for me.

Some background:

I've got variables in my actions that I would like to pass to my layout. 

Currently I'm doing this ...

In my actionController, ---> $this->view->noContentBorder = true;

In the view template for that action, --->
$this->placeholder('noContentBorder')->set($this->noContentBorder);

And then in the layout it's something like, --> if
(isset($this->noContentBorder) && $this->noContentBorder == true) {...

Ok, so I'm wanting to remove the place holder because there are a few views
that have only placeholders for forwarding them to the layout template.

I tried this in the actionController, -->
Zend_Layout::getMvcInstance()->assign('noContentBorder',true);

However, it doesn't seem to work ...

I looked at the assign function in the layout, simply put it assigned the
variable to an array...
-- $this->_container[$spec] = $value;

In the render function, the comments say - * assigns layout variables to
view,...

But, I do not see where the variables from the $this->_container are
assigned to the layout view that is rendered ... 

What am I missing ...

Terre

~ snip render function from zend/layout.php

/**
 * Render layout
 *
 * Sets internal script path as last path on script path stack, assigns 
 * layout variables to view, determines layout name using inflector, and

 * renders layout view script.
 *
 * $name will be passed to the inflector as the key 'script'.
 * 
 * @param  mixed $name 
 * @return mixed
 */ 
public function render($name = null) 
{ 
if (null === $name) {
$name = $this->getLayout();
}

if ($this->inflectorEnabled() && (null !== ($inflector =
$this->getInflector(
{
$name = $this->_inflector->filter(array('script' => $name));
}

$view = $this->getView();

if (null !== ($path = $this->getViewScriptPath())) {
if (method_exists($view, 'addScriptPath')) {
$view->addScriptPath($path);
} else {
$view->setScriptPath($path);
}
} elseif (null !== ($path = $this->getViewBasePath())) {
$view->addBasePath($path, $this->_viewBasePrefix);
}

return $view->render($name);
}






Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Matthew Ratzloff
>
> An interesting thing to note is that a Row Data Gateway acts very
>
similarly to the ActiveRecord; the primary difference is that an
>
ActiveRecord object contains the data access logic, while the Row Data
>
Gateway leaves that aspect to its parent Table Data Gateway, proxying to
>
it. When it comes down to it, for most cases you'll use them in almost
>
exactly the same way -- which I think is what you were getting at in
>
that last sentence.
>

That's true, but when people talk about wanting Active Record support,
they're generally talking about wanting a Rails-like implementation.  That
includes the ability to add simple validation rules easily.
-Matt

On Thu, Nov 6, 2008 at 8:13 AM, Matthew Weier O'Phinney <[EMAIL 
PROTECTED]>wrote:

> -- Paul M Jones <[EMAIL PROTECTED]> wrote
> (on Thursday, 06 November 2008, 09:26 AM -0600):
> >
> > On Nov 6, 2008, at 08:37 , Matthew Weier O'Phinney wrote:
> >
> > > -- Steve Klabnik <[EMAIL PROTECTED]> wrote
> > > (on Thursday, 06 November 2008, 09:23 AM -0500):
> > > > On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney
> > > > <[EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > >There's not. I'm not entirely sure why Zend_Db_Table does not
> > > > implement
> > > >this, though my understanding is that there are some sound
> > > > architectural
> > > >reasons not to do so. I've often created such a method myself,
> > > > though,
> > > >
> > > >
> > > >
> > > >Again, there's not, and again, uncertain as to why. I've often
> > > >implemented such functionality for my own models, however.
> > > >
> > > >
> > > > I'm pretty sure that Cake tries to emulate the ActiveRecord pattern,
> > > > and Zend does not. I did a quick search, and it seems like some
> > > > ActiveRecord-ish stuff was proposed for Zend back in 2006, but never
> > > > took any ground?
> > >
> > > Yes. The reason was that PHP currently does not support a pure
> > > ActiveRecord implementation due to lack of late static binding (LSB --
> > > which will be available in PHP 5.3.0).
> >
> > "Pure" is in the eye of the beholder.  ;-)
> >
> > The Rails Active Record implementation uses static finder methods, and
> > Cake tries to emulate that using instance methods.  Fowler [1] notes
> > that static finder methods "typical", but he goes on to say:
> >
> > "However, there's no reason that you can't separate out
> >  the find methods into a separate class, as I discussed
> >  with Row Data Gateway (152), and that is better for
> >  testing."
> >
> > So it seems perfectly acceptable, from an implementation and "purity"
> > point of view, to have a Table Data Gateway (the finder) return Active
> > Records.
> >
> > Regardless of the *name* of the row class, if it can contain business
> > logic that operates on the row, it can fairly be called an active record
> > implementation.
>
> Right. I was just stating the officially stated reason for why
> ActiveRecord wasn't included originally. :)
>
> An interesting thing to note is that a Row Data Gateway acts very
> similarly to the ActiveRecord; the primary difference is that an
> ActiveRecord object contains the data access logic, while the Row Data
> Gateway leaves that aspect to its parent Table Data Gateway, proxying to
> it. When it comes down to it, for most cases you'll use them in almost
> exactly the same way -- which I think is what you were getting at in
> that last sentence.
>
> > (FYI, Solar  works in a similar manner, with a
> > table/model class to represent the table, and a record class to
> > represent the resulting record (and its related records, if any).  I
> > might argue that the Solar implementation is more sophisticated, but
> > I've self-promoted enough at this point.  ;-)
>
> For the record, for those of you newcomers... PMJ's Solar project is
> top-notch. Additionally, PMJ worked at Zend for a short while, and
> contributed the original Zend_View and Zend_Db_Table implementations to
> ZF. Just thought I should give credit where credit is due. :)
>
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
>


[fw-general] Any "best practice" on how to initialize a database?

2008-11-06 Thread Hakan Şenol Ensari
I'm writing a small application whose underlying layout is by and large
based on Matthew's pastebin. So, the front controller has an initializer
class plugged in, which initializes the database connection, among other
things.

Now, I want the method -- or a similar method, if I'm mixing apples and
oranges here -- to initialize the tables on the database first if it's the
first time it's running. (I'm working with Sqlite so all else is handled by
the server itself.)

The following little hack of the original initDb method does the job.
Basically, I threw in a cache check to see if the tables already exist and,
in case they don't, we go ahead and create them, in tedious procedural
style.

public function initDb()
>
{
>
$config = $this->_config->db;
>
$db = Zend_Db::factory($config->cxn);
>

> Zend_Db_Table_Abstract::setDefaultAdapter($db);
>

> if (!($this->_cache->load('tables_exist'))) {
>

> $sql = array();
>
$sql[] = 'CREATE TABLE IF NOT EXISTS foo (id INTEGER PRIMARY KEY
> AUTOINCREMENT, some_text TEXT)';
>
$sql[] = 'CREATE TABLE IF NOT EXISTS bar (id INTEGER PRIMARY KEY
> AUTOINCREMENT, some_text TEXT)';
>
foreach ($sql as $q) {
>
$db->query($q);
>
}
>

> $this->_cache->save(1, null, array(), null);
>

> }
>

> return $this;
>
}
>

I'm wondering if there's a more beautiful way to accomplish this, perhaps by
moving table definitions to a config. Would love to hear your comments.
Cheers!

Senol

-- 

~+ http://ultra.bohe.me +~


[fw-general] Implementing Simple Authentication - Is This Secure?

2008-11-06 Thread Phoenix

Hi list, first time poster here so please be gentle ;-)

I'm getting up and running with Zend Framework for the first time and 
have googled and read documentation profusely, and have a working 
authentication setup, but I wanted to post it to this list and ask one 
question: is this secure?


There's one hole I'm aware of that I'll explain below, but I want to be 
sure that my implementation - specifically, my use of init() to ensure 
the user is authenticated for all actions in the controller - is 
considered within "best practices".  If not, I need to know what I 
should be doing instead.


The way this works is that there is ONE and only one user in the users 
table in the database.  It's got a username, password, and of course ID 
- that's it.  The password is stored as an MD5 checksum in the password 
field.


When the "admin" controller is accessed, I want the very first thing 
that happens to be a check to see if the user that's logged in is 
authenticated.  If not, it should redirect to the login form and 
terminate immediately.  I believe the use of init() takes care of this, 
but let me know if I'm missing something here.  Should I be using 
__construct instead, for example?


The only hole I can see with this implementation is if somebody gained 
access to my database, for any reason, and inserted another row into the 
admin table, they could login and have the same control over this that I 
do.  I'll implement other controls to restrict that of course, but I 
want to be sure the direction I'm taking here is solid before I get too 
deep.


Enough BS, here's the code - please let me know what you think.

- Phoenix

AdminController.php:
-
  
   public function init()

   {
   $this->view->title = "Admin Controller";
   $this->_helper->layout->setLayout('admin');
  
   // Authentication

   $auth = Zend_Auth::getInstance();
   if(!$auth->hasIdentity()) {
   // User is not authenticated, so return a redirect.
   return $this->_helper->redirector("index", "login");
   }
  
   }


// All my other actions down here, none of which can be accessed without 
going through init(), right?





LoginController.php
-
  
   public function indexAction()

   {
   $this->view->form = $this->getForm();
   }
  
   public function getForm()

   {
   require_once(FORMS_PATH.'/loginform.php');
   return new LoginForm(array('action' => '/login/process', 
'method' => 'post'));

   }

   public function preDispatch()
   {
   if(Zend_Auth::getInstance()->hasIdentity()) {
   if('logout' != $this->getRequest()->getActionName()) {
   $this->_helper->redirector('index', 'admin');
   }
   }
  
   else {

   if('logout' == $this->getRequest()->getActionName()) {
   $this->_helper->redirector('index');
   }
   }
  
   }
  
  
  
   public function processAction()

   {
   $request = $this->getRequest();
  
   // If this ISN'T a post request, redirect and die

   if(!$request->isPost()) {
   return $this->_helper->redirector('index');
   }
  
  
   // Retrieve and validate form

   $form = $this->getForm();
   if(!$form->isValid($request->getPost())) {
   // Invalid form entries
   $this->view->form = $form;
   return $this->render('index'); // re-render the login form
   }
  
   // Set up $username and $password

   $username = $form->getValue('username');
   $password = $form->getValue('password');
  
   // Get authentication adapter and check credentials.

   require_once(MODELS_PATH.'/auth.php');
   $adapter = new AuthAdapter($username, $password);
   $auth = Zend_Auth::getInstance();
   $result = $auth->authenticate($adapter);
  
   // Test to see if they're authenticated or not

   if(!$result->isValid()) {
   // NOT authenticated
   $form->setDescription("Your login failed.");
   $this->view->form = $form;
   return $this->render('index');
   }
  
   // If we made it past all the if/return combinations, we're 
authenticated

   $this->_helper->redirector('index', 'admin');
  
  
   }
  
   public function logoutAction()

   {
   Zend_Auth::getInstance()->clearIdentity();
   $this->_helper->redirector('index', 'index');
   }
  
  
}




And finally, my authentication class:  auth.php
-
username = $username;
   $this->password = $password;
   }
  
  
   /*

* Performs an authentication attempt
*
* @throws Zend_Auth_Adapter_Exception If authentication cannot be 
performed

*
* @return Zend_Auth_Result
*/
   public function authenticate()
   {
   // set up authentication adapter
   $adapter = new Zend_Auth_Adapter_DbTable($this->g

[fw-general] Layout assign function...

2008-11-06 Thread Terre Porter
Hello,
 
I've got myself a bit confused, maybe someone can clarify this for me.

Some background:

I've got variables in my actions that I would like to pass to my layout. 

Currently I'm doing this ...

In my actionController, ---> $this->view->noContentBorder = true;

In the view template for that action, --->
$this->placeholder('noContentBorder')->set($this->noContentBorder);

And then in the layout it's something like, --> if
(isset($this->noContentBorder) && $this->noContentBorder == true) {...

Ok, so I'm wanting to remove the place holder because there are a few views
that have only placeholders for forwarding them to the layout template.

I tried this in the actionController, -->
Zend_Layout::getMvcInstance()->assign('noContentBorder',true);

However, it doesn't seem to work ...

I looked at the assign function in the layout, simply put it assigned the
variable to an array...
-- $this->_container[$spec] = $value;

In the render function, the comments say - * assigns layout variables to
view,...

But, I do not see where the variables from the $this->_container are
assigned to the layout view that is rendered ... 

What am I missing ...

Terre

~ snip render function from zend/layout.php

/**
 * Render layout
 *
 * Sets internal script path as last path on script path stack, assigns 
 * layout variables to view, determines layout name using inflector, and

 * renders layout view script.
 *
 * $name will be passed to the inflector as the key 'script'.
 * 
 * @param  mixed $name 
 * @return mixed
 */ 
public function render($name = null) 
{ 
if (null === $name) {
$name = $this->getLayout();
}

if ($this->inflectorEnabled() && (null !== ($inflector =
$this->getInflector(
{
$name = $this->_inflector->filter(array('script' => $name));
}

$view = $this->getView();

if (null !== ($path = $this->getViewScriptPath())) {
if (method_exists($view, 'addScriptPath')) {
$view->addScriptPath($path);
} else {
$view->setScriptPath($path);
}
} elseif (null !== ($path = $this->getViewBasePath())) {
$view->addBasePath($path, $this->_viewBasePrefix);
}

return $view->render($name);
}





[fw-general] ZendX_Doctrine_Auth_Adapter - seeking comments

2008-11-06 Thread jasoneisen

Compare the following:

http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Auth/Adapter/DbTable.php

vs

http://framework.zend.com/svn/framework/extras/incubator/library/ZendX/Doctrine/Auth/Adapter.php

At least 90% of the code is repeated. I propose we abstract out the public  
methods (minus authenticate()) in DbTable to a  
Zend_Auth_Adapter_Db_Abstract or something so that Doctrine (or any other  
DBAL) can extend from it.



Jason Eisenmenger


Re: [fw-general] Zend_Cache Get Tags

2008-11-06 Thread Fabien MARTY

Hi,

SiCo007 a écrit :

Hi, how do I 'easily' get the tags for a cache file now? It used to be a case
of each tag was it's own file, now I see they are stored in an array inside
a meta file.

Do I simply open each file or are there Zend_Cache methods to this for me? -
I didn't see them in the code so thought I'd check before re-inventing the
wheel!

Thanks

-
Simon

http://www.ajb007.co.uk/
  



Starting with ZF 1.7 Preview Release, you can use the getTags() method 
on your cache object.


It works with backends which support the "extended interface" :
'File', 'Apc', 'TwoLevels', 'Memcached', 'Sqlite' (for the moment)

For your information, here is the extended interface :

   /**
* Return an array of stored cache ids
*
* @return array array of stored cache ids (string)
*/
   public function getIds();
  
   /**

* Return an array of stored tags
*
* @return array array of stored tags (string)
*/
   public function getTags();
  
   /**

* Return an array of stored cache ids which match given tags
*
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
* @return array array of matching cache ids (string)
*/
   public function getIdsMatchingTags($tags = array());

   /**
* Return an array of stored cache ids which don't match given tags
*
* In case of multiple tags, a logical OR is made between tags
*
* @param array $tags array of tags
* @return array array of not matching cache ids (string)
*/   
   public function getIdsNotMatchingTags($tags = array());
  
   /**

* Return the filling percentage of the backend storage
*
* @return int integer between 0 and 100
*/
   public function getFillingPercentage();

   /**
* Return an array of metadatas for the given cache id
*
* The array must include these keys :
* - expire : the expire timestamp
* - tags : a string array of tags
* - mtime : timestamp of last modification time
*
* @param string $id cache id
* @return array array of metadatas (false if the cache id is not found)
*/
   public function getMetadatas($id);
  
   /**

* Give (if possible) an extra lifetime to the given cache id
*
* @param string $id cache id
* @param int $extraLifetime
* @return boolean true if ok
*/
   public function touch($id, $extraLifetime);
  
   /**

* Return an associative array of capabilities (booleans) of the backend
*
* The array must include these keys :
* - automatic_cleaning (is automating cleaning necessary)
* - tags (are tags supported)
* - expired_read (is it possible to read expired cache records
* (for doNotTestCacheValidity option for example))
* - priority does the backend deal with priority when saving
* - infinite_lifetime (is infinite lifetime can work with this backend)
* - get_list (is it possible to get the list of cache ids and the 
complete list of tags)

*
* @return array associative of with capabilities
*/
   public function getCapabilities();
  
Regards,


Fabien


[fw-general] Zend_Db_Table_Rowset seek() question

2008-11-06 Thread Jason Austin
I have a need to paginate some simple results, which I need the count of 
the entire rowset, and then rows from a particular offset.  I don't 
really want to execute 2 queries, so I was thinking of using the seek() 
method of my result set to put the pointer to the required offset, 
however when I loop through the results it starts over at the beginning 
of the result set:


fetchAll($where, $order);

$rows->seek($page * $resultsPerPage);

echo $rows->current()->id  // echoes correct "seek()" offset ID

foreach ($rows as $r) {  // starts over at the beginning of the rowset
   // add to result set
}

?>

Is this the expected behavior or am I missing something totally 
obvious?  This is with version 1.6.1.  Should I just do 2 queries (a 
query to get the required rows, then a count query without qualifier)?


Thanks!
Jason

--
Jason Austin
Senior Solutions Implementation Engineer
NC State University - Office of Information Technology
http://webapps.ncsu.edu
919.513-4372



Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Matthew Weier O'Phinney
-- Paul M Jones <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 09:26 AM -0600):
>
> On Nov 6, 2008, at 08:37 , Matthew Weier O'Phinney wrote:
>
> > -- Steve Klabnik <[EMAIL PROTECTED]> wrote
> > (on Thursday, 06 November 2008, 09:23 AM -0500):
> > > On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney 
> > > <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > >There's not. I'm not entirely sure why Zend_Db_Table does not  
> > > implement
> > >this, though my understanding is that there are some sound  
> > > architectural
> > >reasons not to do so. I've often created such a method myself,  
> > > though,
> > >
> > >
> > >
> > >Again, there's not, and again, uncertain as to why. I've often
> > >implemented such functionality for my own models, however.
> > >
> > >
> > > I'm pretty sure that Cake tries to emulate the ActiveRecord pattern,
> > > and Zend does not. I did a quick search, and it seems like some
> > > ActiveRecord-ish stuff was proposed for Zend back in 2006, but never
> > > took any ground?
> >
> > Yes. The reason was that PHP currently does not support a pure
> > ActiveRecord implementation due to lack of late static binding (LSB --
> > which will be available in PHP 5.3.0).
>
> "Pure" is in the eye of the beholder.  ;-)
>
> The Rails Active Record implementation uses static finder methods, and  
> Cake tries to emulate that using instance methods.  Fowler [1] notes  
> that static finder methods "typical", but he goes on to say:
>
> "However, there's no reason that you can't separate out
>  the find methods into a separate class, as I discussed
>  with Row Data Gateway (152), and that is better for
>  testing."
>
> So it seems perfectly acceptable, from an implementation and "purity"  
> point of view, to have a Table Data Gateway (the finder) return Active  
> Records.
>
> Regardless of the *name* of the row class, if it can contain business  
> logic that operates on the row, it can fairly be called an active record 
> implementation.

Right. I was just stating the officially stated reason for why
ActiveRecord wasn't included originally. :)

An interesting thing to note is that a Row Data Gateway acts very
similarly to the ActiveRecord; the primary difference is that an
ActiveRecord object contains the data access logic, while the Row Data
Gateway leaves that aspect to its parent Table Data Gateway, proxying to
it. When it comes down to it, for most cases you'll use them in almost
exactly the same way -- which I think is what you were getting at in
that last sentence.

> (FYI, Solar  works in a similar manner, with a  
> table/model class to represent the table, and a record class to  
> represent the resulting record (and its related records, if any).  I  
> might argue that the Solar implementation is more sophisticated, but  
> I've self-promoted enough at this point.  ;-)

For the record, for those of you newcomers... PMJ's Solar project is
top-notch. Additionally, PMJ worked at Zend for a short while, and
contributed the original Zend_View and Zend_Db_Table implementations to
ZF. Just thought I should give credit where credit is due. :)

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] QuickStart and creating a SQLite database

2008-11-06 Thread zig

Hello,

you must create these files (in my configuration):
touch /var/www/QuickStart/data/db/guestbook.db
touch /var/www/QuickStart/data/db/guestbook-dev.db
touch /var/www/QuickStart/data/db/guestbook-testing.db
a+


Steve Horejsi wrote:
> 
>  I am getting a failure while trying to create the demo database:
> 
> Writing Database Guestbook in (control-c to cancel):
> AN ERROR HAS OCCURED:
> SQLSTATE[HY000] [14] unable to open database file
> 
>  I can't seem to find any logs anywhere that would tell me what is
> failing. I have he perms on the whole QuickStart directory tree set so
> that Apache is the Group owner and has read/write.
> 
>  Where next?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/QuickStart-and-creating-a-SQLite-database-tp20154515p20363373.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Paul M Jones


On Nov 6, 2008, at 08:37 , Matthew Weier O'Phinney wrote:


-- Steve Klabnik <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 09:23 AM -0500):
On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED] 
>

wrote:

   There's not. I'm not entirely sure why Zend_Db_Table does not  
implement
   this, though my understanding is that there are some sound  
architectural
   reasons not to do so. I've often created such a method myself,  
though,




   Again, there's not, and again, uncertain as to why. I've often
   implemented such functionality for my own models, however.


I'm pretty sure that Cake tries to emulate the ActiveRecord pattern,
and Zend does not. I did a quick search, and it seems like some
ActiveRecord-ish stuff was proposed for Zend back in 2006, but never
took any ground?


Yes. The reason was that PHP currently does not support a pure
ActiveRecord implementation due to lack of late static binding (LSB --
which will be available in PHP 5.3.0).


"Pure" is in the eye of the beholder.  ;-)

The Rails Active Record implementation uses static finder methods, and  
Cake tries to emulate that using instance methods.  Fowler [1] notes  
that static finder methods "typical", but he goes on to say:


"However, there's no reason that you can't separate out
 the find methods into a separate class, as I discussed
 with Row Data Gateway (152), and that is better for
 testing."

So it seems perfectly acceptable, from an implementation and "purity"  
point of view, to have a Table Data Gateway (the finder) return Active  
Records.


Regardless of the *name* of the row class, if it can contain business  
logic that operates on the row, it can fairly be called an active  
record implementation.


(FYI, Solar  works in a similar manner, with a  
table/model class to represent the table, and a record class to  
represent the resulting record (and its related records, if any).  I  
might argue that the Solar implementation is more sophisticated, but  
I've self-promoted enough at this point.  ;-)



[1] Fowler, Martin.  "Patterns of Enterprise Application Development."  
Page 161.




--

Paul M. Jones
http://paul-m-jones.com/






Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Karol Grecki

Does it work on 64bit Linux?
I run the executable but it just quits after a second without any message
whatsoever.

Karol


rcastley wrote:
> 
> A bit off-list but those Zend guys have packaged an all-in-one build of
> the
> latest PDT 2.0 and Eclipse 3.4.
>  
> http://downloads.zend.com/pdt/all-in-one/
>  
> 

-- 
View this message in context: 
http://www.nabble.com/Zend-PDT-2.0-all-in-one-available-%28BETA%29-tp20358199p2036.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Matthew Weier O'Phinney
-- Steve Klabnik <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 09:23 AM -0500):
> On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
> There's not. I'm not entirely sure why Zend_Db_Table does not implement
> this, though my understanding is that there are some sound architectural
> reasons not to do so. I've often created such a method myself, though,
> 
> 
> 
> Again, there's not, and again, uncertain as to why. I've often
> implemented such functionality for my own models, however.
> 
> 
> I'm pretty sure that Cake tries to emulate the ActiveRecord pattern,
> and Zend does not. I did a quick search, and it seems like some
> ActiveRecord-ish stuff was proposed for Zend back in 2006, but never
> took any ground?

Yes. The reason was that PHP currently does not support a pure
ActiveRecord implementation due to lack of late static binding (LSB --
which will be available in PHP 5.3.0).

What that essentially meant was that we could not do the following:

$bug = Bug::find(3);

simply by declaring the following:

class Bug extends Zend_ActiveRecord
{
}

due to the fact that 'self' always refers to the defining class, not the
class from which it was called.

ZF implements the Table Data Gateway and Row Data Gateway via
Zend_Db_Table and Zend_Db_Table_Row. These are incredibly flexible, and
do not require the use of static methods -- which allows them to bypass
LSB and simply work. RDGs are very similar to ActiveRecord in use.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


RE: [fw-general] Why will Zend_Config be autoloaded?

2008-11-06 Thread Jan Pieper
I don´t think so. That´s my bootstrap. And without autoloading I won´t get an 
error. So it must be loaded.

> -Original Message-
> From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, November 06, 2008 3:32 PM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Why will Zend_Config be autoloaded?
> 
> -- Jan Pieper <[EMAIL PROTECTED]> wrote
> (on Thursday, 06 November 2008, 03:20 PM +0100):
> > There is no problem, but I am confused why it will be autoloaded
> > altought it is already loaded. I thought autoload will *only* load
> > classes that are not loaded until they are required.
> 
> It's possible that another class or some other code in your app is
> referring to Zend_Config prior to you loading Zend_Config_Xml.
> 
> > 
> > > -Original Message-
> > > From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
> > > Sent: Thursday, November 06, 2008 3:15 PM
> > > To: fw-general@lists.zend.com
> > > Subject: Re: [fw-general] Why will Zend_Config be autoloaded?
> > > 
> > > -- Jan Pieper <[EMAIL PROTECTED]> wrote
> > > (on Thursday, 06 November 2008, 11:52 AM +0100):
> > > > registered autoloader (Zend_Loader::registerAutoload) in my
> > > > application to not even add require_once statement for temporary
> > > > needed classes for debugging etc. and I added HTML output to
> > > > autoload() method to know if classes will be autoloaded. 
> > > Now it seems
> > > > that Zend_Config will be autoloaded but I don´t know why.
> > > > 
> > > >  - SNIP -
> > > > 
> > > >  > > > 
> > > > require_once 'Zend/Loader.php';
> > > > Zend_Loader::registerAutoload();
> > > > 
> > > > require_once 'Zend/Config/Xml.php';
> > > > $config = new Zend_Config_Xml(realpath('../config/config.xml'));
> > > > 
> > > > [...]
> > > > 
> > > >  - SNAP -
> > > > 
> > > > I added debug_print_backtrace() to 
> Zend_Loader::autload() method to
> > > > find out why it will be autoloaded:
> > > > 
> > > > #0  Zend_Loader::autoload(Zend_Config)
> > > > #1  spl_autoload_call(Zend_Config) called at 
> > > [C:\Server\workspace\flabben\htdocs\index.php:6]
> > > > #2  require_once() called at 
> > > [C:\Server\workspace\flabben\htdocs\index.php:6]
> > > > 
> > > > So I thought Zend_Config_Xml does not include 
> > > "Zend/Config.php" but it
> > > > do. If I unregister autoloader, my application works fine 
> > > without any
> > > > problems, so Zend_Config must be available.
> > > > 
> > > > Someone can tell me why Zend_Config will be autoloaded?
> > > 
> > > Is there a problem with it being autoloaded? I'm a bit 
> confused as to
> > > what the issue is here...
> > > 
> > > -- 
> > > Matthew Weier O'Phinney
> > > Software Architect   | [EMAIL PROTECTED]
> > > Zend Framework   | http://framework.zend.com/
> > > 
> > > 
> > 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


Re: [fw-general] Why will Zend_Config be autoloaded?

2008-11-06 Thread Matthew Weier O'Phinney
-- Jan Pieper <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 03:20 PM +0100):
> There is no problem, but I am confused why it will be autoloaded
> altought it is already loaded. I thought autoload will *only* load
> classes that are not loaded until they are required.

It's possible that another class or some other code in your app is
referring to Zend_Config prior to you loading Zend_Config_Xml.

> 
> > -Original Message-
> > From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, November 06, 2008 3:15 PM
> > To: fw-general@lists.zend.com
> > Subject: Re: [fw-general] Why will Zend_Config be autoloaded?
> > 
> > -- Jan Pieper <[EMAIL PROTECTED]> wrote
> > (on Thursday, 06 November 2008, 11:52 AM +0100):
> > > registered autoloader (Zend_Loader::registerAutoload) in my
> > > application to not even add require_once statement for temporary
> > > needed classes for debugging etc. and I added HTML output to
> > > autoload() method to know if classes will be autoloaded. 
> > Now it seems
> > > that Zend_Config will be autoloaded but I don´t know why.
> > > 
> > >  - SNIP -
> > > 
> > >  > > 
> > > require_once 'Zend/Loader.php';
> > > Zend_Loader::registerAutoload();
> > > 
> > > require_once 'Zend/Config/Xml.php';
> > > $config = new Zend_Config_Xml(realpath('../config/config.xml'));
> > > 
> > > [...]
> > > 
> > >  - SNAP -
> > > 
> > > I added debug_print_backtrace() to Zend_Loader::autload() method to
> > > find out why it will be autoloaded:
> > > 
> > > #0  Zend_Loader::autoload(Zend_Config)
> > > #1  spl_autoload_call(Zend_Config) called at 
> > [C:\Server\workspace\flabben\htdocs\index.php:6]
> > > #2  require_once() called at 
> > [C:\Server\workspace\flabben\htdocs\index.php:6]
> > > 
> > > So I thought Zend_Config_Xml does not include 
> > "Zend/Config.php" but it
> > > do. If I unregister autoloader, my application works fine 
> > without any
> > > problems, so Zend_Config must be available.
> > > 
> > > Someone can tell me why Zend_Config will be autoloaded?
> > 
> > Is there a problem with it being autoloaded? I'm a bit confused as to
> > what the issue is here...
> > 
> > -- 
> > Matthew Weier O'Phinney
> > Software Architect   | [EMAIL PROTECTED]
> > Zend Framework   | http://framework.zend.com/
> > 
> > 
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Steve Klabnik
On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney <[EMAIL 
PROTECTED]>wrote:

> There's not. I'm not entirely sure why Zend_Db_Table does not implement
> this, though my understanding is that there are some sound architectural
> reasons not to do so. I've often created such a method myself, though,
>


Again, there's not, and again, uncertain as to why. I've often
> implemented such functionality for my own models, however.
>

I'm pretty sure that Cake tries to emulate the ActiveRecord pattern, and
Zend does not. I did a quick search, and it seems like some ActiveRecord-ish
stuff was proposed for Zend back in 2006, but never took any ground?


RE: [fw-general] Why will Zend_Config be autoloaded?

2008-11-06 Thread Jan Pieper
There is no problem, but I am confused why it will be autoloaded altought it is 
already loaded. I thought autoload will *only* load classes that are not loaded 
until they are required.

> -Original Message-
> From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, November 06, 2008 3:15 PM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Why will Zend_Config be autoloaded?
> 
> -- Jan Pieper <[EMAIL PROTECTED]> wrote
> (on Thursday, 06 November 2008, 11:52 AM +0100):
> > registered autoloader (Zend_Loader::registerAutoload) in my
> > application to not even add require_once statement for temporary
> > needed classes for debugging etc. and I added HTML output to
> > autoload() method to know if classes will be autoloaded. 
> Now it seems
> > that Zend_Config will be autoloaded but I don´t know why.
> > 
> >  - SNIP -
> > 
> >  > 
> > require_once 'Zend/Loader.php';
> > Zend_Loader::registerAutoload();
> > 
> > require_once 'Zend/Config/Xml.php';
> > $config = new Zend_Config_Xml(realpath('../config/config.xml'));
> > 
> > [...]
> > 
> >  - SNAP -
> > 
> > I added debug_print_backtrace() to Zend_Loader::autload() method to
> > find out why it will be autoloaded:
> > 
> > #0  Zend_Loader::autoload(Zend_Config)
> > #1  spl_autoload_call(Zend_Config) called at 
> [C:\Server\workspace\flabben\htdocs\index.php:6]
> > #2  require_once() called at 
> [C:\Server\workspace\flabben\htdocs\index.php:6]
> > 
> > So I thought Zend_Config_Xml does not include 
> "Zend/Config.php" but it
> > do. If I unregister autoloader, my application works fine 
> without any
> > problems, so Zend_Config must be available.
> > 
> > Someone can tell me why Zend_Config will be autoloaded?
> 
> Is there a problem with it being autoloaded? I'm a bit confused as to
> what the issue is here...
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


Re: [fw-general] Why will Zend_Config be autoloaded?

2008-11-06 Thread Matthew Weier O'Phinney
-- Jan Pieper <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 11:52 AM +0100):
> registered autoloader (Zend_Loader::registerAutoload) in my
> application to not even add require_once statement for temporary
> needed classes for debugging etc. and I added HTML output to
> autoload() method to know if classes will be autoloaded. Now it seems
> that Zend_Config will be autoloaded but I don´t know why.
> 
>  - SNIP -
> 
>  
> require_once 'Zend/Loader.php';
> Zend_Loader::registerAutoload();
> 
> require_once 'Zend/Config/Xml.php';
> $config = new Zend_Config_Xml(realpath('../config/config.xml'));
> 
> [...]
> 
>  - SNAP -
> 
> I added debug_print_backtrace() to Zend_Loader::autload() method to
> find out why it will be autoloaded:
> 
> #0  Zend_Loader::autoload(Zend_Config)
> #1  spl_autoload_call(Zend_Config) called at 
> [C:\Server\workspace\flabben\htdocs\index.php:6]
> #2  require_once() called at [C:\Server\workspace\flabben\htdocs\index.php:6]
> 
> So I thought Zend_Config_Xml does not include "Zend/Config.php" but it
> do. If I unregister autoloader, my application works fine without any
> problems, so Zend_Config must be available.
> 
> Someone can tell me why Zend_Config will be autoloaded?

Is there a problem with it being autoloaded? I'm a bit confused as to
what the issue is here...

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Matthew Weier O'Phinney
-- Rob Allen <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 07:03 AM +):
> On 5 Nov 2008, at 23:23, Matthew Weier O'Phinney wrote:
>
> > -- WildFoxMedia <[EMAIL PROTECTED]> wrote
> > (on Wednesday, 05 November 2008, 02:48 PM -0800):
> > > Hey guys, im new to Zend, ive been a long time user of Cake, I
> > > have  a few questions related to conventions, etc.
>
> > > 2. Is there a 'magic' save() method for saving to the database? I see
> > > currently there is Insert & Update, I dont mind using insert &
> > > update, was just curious.
> >
> > There's not. I'm not entirely sure why Zend_Db_Table does not
> > implement this, though my understanding is that there are some sound
> > architectural reasons not to do so. I've often created such a method
> > myself, though,
>
> Zend_Db_Table_Row has save().
>
> $table = new Pages();
> $page = $id > 0 ? $table-> fetchRow('id='.$id) : $table-> createRow();
> $page-> title = $newTitle;
> $page-> body = $newBody;
> $page-> save();

Ah, right. But Zend_Db_Table itself does not have it. (I typically don't
use the row objects -- probably should).

> > > 3. Is there any kind of table inflection when you insert or update?  
> > > What I mean is if you have a table with 2 columns, id & name the
> > > array I  try to insert has 3 array keys for id, name & created it
> > > throws an error -  Cake does table inflection where it only
> > > attempts to save columns that  exist in the table.
> >
> > Again, there's not, and again, uncertain as to why. I've often
> > implemented such functionality for my own models, however.
>
> Zend_Db_Table_Row won't let you use a property that doesn't exist as a  
> row.
>
> i.e:  $page-> not_in_db = '0'; will throw an exception.

Right -- and Zend_Db_Table::insert() and update() also throw exceptions
if you attempt to save a key that does not resolve to a field. I
personally feel we should have a flag allowing these methods to ignore
unknown keys -- it would make saving data to multiple tables much
easier.

> > > 4. Is there any decent way to autoload models instead of doing
> > > $this-> someModel = new someModel; in the init() of every controller?
> >
> > No. If you're interested in doing something like this, however, you
> > may want to look at action helpers, and in particular how the
> > ViewRenderer action helper works (it does this sort of functionality
> > for views).
>
> Funnily enough, I just wrote an article on hooks in action helpers at 
> http://akrabat.com.
>
> Essentially, you need to write an action helper that is along the lines 
> of:
>
> class Zend_Controller_Action_Helper_ModelLoader extends  
> Zend_Controller_Action_Helper_Abstract
> {
> function preDispatch()
> {
> $controller = $this-> getActionController();
>
>   $modelName = $this-> _pickModelToLoadBasedOnControllerName($controller);
> $controller-> $modelName = new $modelName;
> }
>
> protected function  
> _pickModelToLoadBasedOnControllerName($controller)
> {
> // implementation here - return a string
> }
> }
>
> Then you register it with the helper broker in your bootstrap.

There's also an article I wrote on action helpers for a more in-depth
look:

http://devzone.zend.com/article/3350-Action-Helpers-in-Zend-Framework

The DevZone has a lot of ZF tutorials. Rob himself has also written a
ton on his website, as well as the website for his upcoming book, Zend
Framework in Action. 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: Re: [fw-general] Tags for the memcached and APC backends for Zend_Cache - new approach

2008-11-06 Thread agatone

Hello,

I'm sorry for replying to older post but I need to clear some things.

I don't understand how this TwoLevels cache should work and I see some odd
results quick tests.
Is that it will use fast cache for untagged entries, and slow for tagged
entries? Cuz sometimes I see both entries in APC and in SQLite
Sometimes I see it only in SQLite.

My quick testing using TwoLevels, showed that application became much slower
than without the cache.
I used APC-SQLite.

And sometimes it throws fatal erros when it tries to access cached data as
array although it's object.
Check file TwoLevels.php on line 206 (or so)


Fabien MARTY wrote:
> 
> Hi,
> 
> Please have a look at the "TwoLevels" backend in 1.7 trunk (or in 1.7
> PR), it's want you want.
> 
> It does exactly this.
> 
> Feedback welcome
> 
> Regards,
> 
> Fabien
> 
> 
> Fabien MARTY
> [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Tags-for-the-memcached-and-APC-backends-for-Zend_Cache---new-approach-tp20109068p20361612.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Juan Felipe Alvarez Saldarriaga
Cool!

I wrote a how to setting up PDT 2.0 
(http://www.howtoforge.com/setting-up-eclipse-pdt2.0-on-eclipse3.4-ganymede) on 
Ganymede but now with a All-in-One package is better! :), also a bug to include 
the framework still happend 
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=253401) and what about 
integration with RSE ?, still, great job guys!

- Original Message -
From: "Robert Castley" <[EMAIL PROTECTED]>
To: "Vince42" <[EMAIL PROTECTED]>
Cc: fw-general@lists.zend.com
Sent: Thursday, November 6, 2008 7:46:21 AM GMT -05:00 Columbia
Subject: RE: [fw-general] Zend PDT 2.0 all-in-one available (BETA)



When in the PHP explorer do the following: 

Window -> Navigation -> Show View Menu 

Package Presentation -> Hierachical 

- Robert 


-Original Message- 
From: Vince42 [ mailto:[EMAIL PROTECTED] ] 
Sent: Thu 06/11/2008 12:06 
To: fw-general@lists.zend.com 
Subject: Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA) 

Ionut Gabriel Stan schrieb: 
> The representation of folders inside PHP Explorer view is driving me crazy. 
> It should be a tree like structure... 

Yes, but I guess there's some setting, which allows to toggle these view 
modes, as this folder view consumes to much spaces while providing 
irrelevant information and the view is now lacking overview ... just my 
two cents ... 

-- 
Cheers, \\|// 
Vince (o o) 
ooO-(_)-Ooo- 
''' (o)_(o) [ ][0][ ] 
ô¿ô (=°o°=) World Domination by Copy and Paste [ ][ ][0] 
- (")_(") [0][0][0] 

() ascii ribbon campaign - against html e-mail 
/\ www.asciiribbon.org - against proprietary attachments 
Ooo. 
---.ooO( )- 
( ) (_/ 
\_) 

 
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system. 

 
 
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system. 
 


RE: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Robert Castley
When in the PHP explorer do the following:

Window -> Navigation -> Show View Menu

Package Presentation -> Hierachical

- Robert


-Original Message-
From: Vince42 [mailto:[EMAIL PROTECTED]
Sent: Thu 06/11/2008 12:06
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)
 
Ionut Gabriel Stan schrieb:
> The representation of folders inside PHP Explorer view is driving me
crazy.
> It should be a tree like structure...

Yes, but I guess there's some setting, which allows to toggle these view
modes, as this folder view consumes to much spaces while providing
irrelevant information and the view is now lacking overview ... just my
two cents ...

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.




This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Vince42
Ionut Gabriel Stan schrieb:
> The representation of folders inside PHP Explorer view is driving me crazy.
> It should be a tree like structure...

Yes, but I guess there's some setting, which allows to toggle these view
modes, as this folder view consumes to much spaces while providing
irrelevant information and the view is now lacking overview ... just my
two cents ...

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Ionut Gabriel Stan

The representation of folders inside PHP Explorer view is driving me crazy.
It should be a tree like structure...


On 11/6/2008 12:02, Robert Castley wrote:
A bit off-list but those Zend guys have packaged an all-in-one build 
of the latest PDT 2.0 and Eclipse 3.4.

http://downloads.zend.com/pdt/all-in-one/
Had a quick play and the hot-spots for me are:
1) Javascript editor and source formatter included :-)
2) It's quicker
3) Seems stable so far
This is great that they have released this as it means you no longer 
need to build it yourself :-)

- Robert


This email has been scanned for all known viruses by the MessageLabs 
Email Security Service and the Macro 4 plc internal virus protection 
system.






[fw-general] Not possible: Zend_Mail with embed images and attachment

2008-11-06 Thread fischel

I spent much time on sending an email with embed images and some attachments
like pdf-files. I think with version 1.6.2 it is not possible. If i'm wrong,
please let me know.

It is possible to send an email with html-code with embed images. First you
create an image with Zend_Mime_Part. Then you give your object an id
($PartGif->id = "123456789";). In your html-code you set the SRC of the
image to "cid:123456789". This works for every mail-client.

But if you try to add a PDF-Attachment too. It is not possible. Your E-Mail
Client gets only trash. If you confirm with me or not, please post your
opinion.

To solve this problem, it is necessary to mixed several MIME-PART with
different boundarys. But this is not possible with ZEND. The message has to
look like this:

Content-Type: multipart/mixed; boundary="=_1"
  --=_1
  Content-Type: multipart/alternative; boundary="=_2"
  --=_2
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="ISO-8859-1"
message plain text
   --=_2
  Content-Type: multipart/related; boundary="=_3"
  --=_3
  Content-Transfer-Encoding: quoted-printable
  Content-Type: text/html; charset="ISO-8859-1"
  message html text
  --=_3
  Content-Transfer-Encoding: base64
  embed image
  --=_3--
--=_2--
--=_1
Content-Transfer-Encoding: base64
PDF-File
--=_1--


-- 
View this message in context: 
http://www.nabble.com/Not-possible%3A-Zend_Mail-with-embed-images-and-attachment-tp20359353p20359353.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] PDT - my fault

2008-11-06 Thread Vince42
Hi,

wrong download :P It *is* Ganymede ... :))

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


RE: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Robert Castley
Have you downloaded  the correct file?

Make sure you choose one of the following:
 
pdt-2.0.0.S20081102_debugger-5.2.14.v20080602-all-in-one-linux-gtk.tar.gz
  03-Nov-2008 08:58  109M  

pdt-2.0.0.S20081102_debugger-5.2.14.v20080602-all-in-one-macosx-carbon.tar.g
z
  03-Nov-2008 08:58  116M  

pdt-2.0.0.S20081102_debugger-5.2.14.v20080602-all-in-one-win32.zip
 03-Nov-2008 08:58  108M  


  _  


  _  

From: Vince42 [mailto:[EMAIL PROTECTED]
Sent: Thu 06/11/2008 10:53
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)


Hi, 

Robert Castley schrieb: 
> A bit off-list but those Zend guys have packaged an all-in-one build of
the 
> latest PDT 2.0 and Eclipse 3.4. 

When starting eclipse, it says "Europa" and not "Ganymede" ... are you 
sure that it is Eclipse 3.4? 

-- 
Cheers,\\|// 
Vince  (o o) 
ooO-(_)-Ooo- 
 '''   (o)_(o)[ ][0][ ] 
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0] 
  -(")_(")[0][0][0] 

 ()  ascii ribbon campaign - against html e-mail 
 /\  www.asciiribbon.org   - against proprietary attachments 
   Ooo. 
---.ooO(  )- 
   (  )(_/ 
\_) 

 
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.

 



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Vince42
Hi,

Robert Castley schrieb:
> A bit off-list but those Zend guys have packaged an all-in-one build of the
> latest PDT 2.0 and Eclipse 3.4.

When starting eclipse, it says "Europa" and not "Ganymede" ... are you
sure that it is Eclipse 3.4?

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -(")_(")[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


[fw-general] Why will Zend_Config be autoloaded?

2008-11-06 Thread Jan Pieper
Hi guys,

registered autoloader (Zend_Loader::registerAutoload) in my application to not 
even add require_once statement for temporary needed classes for debugging etc. 
and I added HTML output to autoload() method to know if classes will be 
autoloaded. Now it seems that Zend_Config will be autoloaded but I don´t know 
why.

 - SNIP -



[fw-general] Zend PDT 2.0 all-in-one available (BETA)

2008-11-06 Thread Robert Castley
A bit off-list but those Zend guys have packaged an all-in-one build of the
latest PDT 2.0 and Eclipse 3.4.
 
http://downloads.zend.com/pdt/all-in-one/
 
 
Had a quick play and the hot-spots for me are:
 
1) Javascript editor and source formatter included :-)
2) It's quicker
3) Seems stable so far
 
This is great that they have released this as it means you no longer need to
build it yourself :-)
 
- Robert



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


[fw-general] Zend_Cache Get Tags

2008-11-06 Thread SiCo007

Hi, how do I 'easily' get the tags for a cache file now? It used to be a case
of each tag was it's own file, now I see they are stored in an array inside
a meta file.

Do I simply open each file or are there Zend_Cache methods to this for me? -
I didn't see them in the code so thought I'd check before re-inventing the
wheel!

Thanks

-
Simon

http://www.ajb007.co.uk/
-- 
View this message in context: 
http://www.nabble.com/Zend_Cache-Get-Tags-tp20357780p20357780.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] ZF Best Practices for someone who has been using Cake

2008-11-06 Thread Laurent Melmoux

Hi ben,


WildFoxMedia a écrit :

Hey guys, im new to Zend, ive been a long time user of Cake, I have a few
questions related to conventions, etc.

1. Can someone possibly post a bootstrap/index file for a modular file
convention where there are seperate controllers/views for public and admin
modules that share models?
  

So far I have tried 2 solutions

1)2 bootstraps index who share the same bootstrap class  and rely on 
Acl to isolate admin controller


  /public/index.php and /public/admin/index.php


2)A backend directory to isolate admin controller and view

/modules
   /articles
   
   /controllers

   /ArticleController.php
   /models
   /views

   /backend 
   /controllers

   /IndexController.php
   /views

then detect in your bootstrap if you are in admin mode and if so do:
$this->_front->setModuleControllerDirectoryName('backend/controllers');
  




2. Is there a 'magic' save() method for saving to the database? I see
currently there is Insert & Update, I dont mind using insert & update, was
just curious.

3. Is there any kind of table inflection when you insert or update? What I
mean is if you have a table with 2 columns, id & name the array I try to
insert has 3 array keys for id, name & created it throws an error - Cake
does table inflection where it only attempts to save columns that exist in
the table.
  


see http://framework.zend.com/issues/browse/ZF-2243


4. Is there any decent way to autoload models instead of doing
$this->someModel = new someModel; in the init() of every controller?

5. Whats the correct method for gathering the filtered data from a
controller, I saw in a tutorial where you basically check if the request is
a post, then you assign the POST array to a variable, then you loop through
each array key and do getValue() from the Form object...like this...

$formModel = new FormModel;

$dbRow = array();

foreach($postArray as $pKey => $pValue) {
$dbRow[$pKey] = $formModel->getValue($pKey);
}

Is that the best way?

Thank you
  


Regards,

--
Laurent Melmoux