2010年12月6日星期一

Re: [fw-mvc] [Zend_Config] Questions about heritage

Maybe you can load them separately, convert them to arrays using toArray(),
and then use array_merge(). I hope this helps!

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

On Mon, Dec 6, 2010 at 7:52 AM, Apsy Kopate <apsy.kopate@gmail.com> wrote:

> Hi there :)
>
> I would like to know if there is a solution to "merge" parents branches
> with
> children ones.
>
> I explain by examples :
>
> My XML :
>
> <?xml version="1.0"?>
> <files xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
> <common>
> <files>
> <file><zf:const zf:name="ARBO_JS" />test1.js</file>
> </files>
> </common>
> <index zf:extends="common">
> <files>
> <file><zf:const zf:name="ARBO_JS" />test2.js</file>
> <file><zf:const zf:name="ARBO_JS" />test3.js</file>
> </files>
> </index>
> </files>
>
> Result expected :
> array(
> 'http://www.example.com/js/test1.js',
> 'http://www.example.com/js/test2.js',
> 'http://www.example.com/js/test3.js',
> );
>
> Result actual :
> array(
> 'http://www.example.com/js/test2.js',
> 'http://www.example.com/js/test3.js',
> );
>
> Zend_Config_Xml doesn't merge my parent nodes but overidde them.
>
> Is there a solution to have my result expected ? :)
>
> Thanks folks :)
>

Re: [fw-mvc] Re: Where are the module bootstraps objets saved?

-- Pieter <ptrwrsm@gmail.com> wrote
(on Sunday, 05 December 2010, 05:47 PM +0100):
> Your example is actually (as of a few versions ago) no longer valid,
> Matthew. Nowadays, the modules resource returns the ArrayObject upon
> initialization. You can now do:

Ah, snap! I forgot that we'd done that to make access easier. Thanks for
correcting that!

> $moduleBootstraps = $bootstrap->getResource('modules');
> $blogBootstrap = $moduleBootstraps['blog'];
>
> Or everything on one line:
>
> $blogBootstrap =
> Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('modules')->blog;
>
> Or if you really want to use getExecutedBootstraps you can do:
>
> $bootstrap->getPluginResource('modules')->getExecutedBootstraps();
>
>
> On Fri, Dec 3, 2010 at 8:09 PM, Matthew Weier O'Phinney
> <matthew@zend.com> wrote:
> > -- Marko78 <marko.korhonen@gmail.com> wrote
> > (on Friday, 03 December 2010, 10:13 AM -0800):
> >> I did not mean resources like view, cachemanager etc.
> >>
> >> I mean the module bootstrap classes. I have modules in my application
> >> which all have extended from Zend_Application_Module_Bootstrap.
> >
> > Ah -- you didn't specify that in your original message.
> >
> > You *can* get at them, just not easily, via the "modules" resource. Its
> > "getExecutedBootstraps()" method returns an ArrayObject, where the keys
> > are the module names and the values are the bootstrap objects for the
> > modules.
> >
> >    $modules       = $bootstrap->getResource('modules');
> >    $bootstraps    = $modules->getExecutedBootstraps();
> >    $blogBootstrap = $bootstraps['blog'];
> >
> >
> >> I would like to have module hook methods in these module bootstrap
> >> classes as they are already loaded. Then I could loop through these
> >> classes if some code wants to invoke some method, e.g. I have content
> >> form, then tag module can alter this form by adding input field for
> >> tags. If I remove or deactivate tag module, content form won't have
> >> tags field anymore. Same goes for handling the post data when saving
> >> content.
> >>
> >> Does this sound weird?
> >>
> >> br, Marko
> >>
> >> -----
> >> br,
> >> --------------------------
> >> Marko Korhonen
> >> Technical Consultant
> >> --
> >> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3071516.html
> >> Sent from the Zend MVC mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> > PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
> >
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-mvc] [Zend_Config] Questions about heritage

Hi there :)

I would like to know if there is a solution to "merge" parents branches with
children ones.

I explain by examples :

My XML :

<?xml version="1.0"?>
<files xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
<common>
<files>
<file><zf:const zf:name="ARBO_JS" />test1.js</file>
</files>
</common>
<index zf:extends="common">
<files>
<file><zf:const zf:name="ARBO_JS" />test2.js</file>
<file><zf:const zf:name="ARBO_JS" />test3.js</file>
</files>
</index>
</files>

Result expected :
array(
'http://www.example.com/js/test1.js',
'http://www.example.com/js/test2.js',
'http://www.example.com/js/test3.js',
);

Result actual :
array(
'http://www.example.com/js/test2.js',
'http://www.example.com/js/test3.js',
);

Zend_Config_Xml doesn't merge my parent nodes but overidde them.

Is there a solution to have my result expected ? :)

Thanks folks :)

2010年12月5日星期日

Re: [fw-mvc] Re: Where are the module bootstraps objets saved?

Your example is actually (as of a few versions ago) no longer valid,
Matthew. Nowadays, the modules resource returns the ArrayObject upon
initialization. You can now do:

$moduleBootstraps = $bootstrap->getResource('modules');
$blogBootstrap = $moduleBootstraps['blog'];

Or everything on one line:

$blogBootstrap =
Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('modules')->blog;

Or if you really want to use getExecutedBootstraps you can do:

$bootstrap->getPluginResource('modules')->getExecutedBootstraps();


On Fri, Dec 3, 2010 at 8:09 PM, Matthew Weier O'Phinney
<matthew@zend.com> wrote:
> -- Marko78 <marko.korhonen@gmail.com> wrote
> (on Friday, 03 December 2010, 10:13 AM -0800):
>> I did not mean resources like view, cachemanager etc.
>>
>> I mean the module bootstrap classes. I have modules in my application
>> which all have extended from Zend_Application_Module_Bootstrap.
>
> Ah -- you didn't specify that in your original message.
>
> You *can* get at them, just not easily, via the "modules" resource. Its
> "getExecutedBootstraps()" method returns an ArrayObject, where the keys
> are the module names and the values are the bootstrap objects for the
> modules.
>
>    $modules       = $bootstrap->getResource('modules');
>    $bootstraps    = $modules->getExecutedBootstraps();
>    $blogBootstrap = $bootstraps['blog'];
>
>
>> I would like to have module hook methods in these module bootstrap
>> classes as they are already loaded. Then I could loop through these
>> classes if some code wants to invoke some method, e.g. I have content
>> form, then tag module can alter this form by adding input field for
>> tags. If I remove or deactivate tag module, content form won't have
>> tags field anymore. Same goes for handling the post data when saving
>> content.
>>
>> Does this sound weird?
>>
>> br, Marko
>>
>> -----
>> br,
>> --------------------------
>> Marko Korhonen
>> Technical Consultant
>> --
>> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3071516.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Project Lead            | matthew@zend.com
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

[fw-mvc] Re: cannot access zend form

change the class name to Application_Form_LoginForm() and it will work.
The reason you can't access your form is that you are not following the zend
mvc directory structure.
Your forms folder should be in applications folder not outside.
I hope this help.
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/cannot-access-zend-form-tp3072198p3073339.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2010年12月3日星期五

Re: [fw-mvc] Re: Where are the module bootstraps objets saved?

-- Marko78 <marko.korhonen@gmail.com> wrote
(on Friday, 03 December 2010, 10:13 AM -0800):
> I did not mean resources like view, cachemanager etc.
>
> I mean the module bootstrap classes. I have modules in my application
> which all have extended from Zend_Application_Module_Bootstrap.

Ah -- you didn't specify that in your original message.

You *can* get at them, just not easily, via the "modules" resource. Its
"getExecutedBootstraps()" method returns an ArrayObject, where the keys
are the module names and the values are the bootstrap objects for the
modules.

$modules = $bootstrap->getResource('modules');
$bootstraps = $modules->getExecutedBootstraps();
$blogBootstrap = $bootstraps['blog'];


> I would like to have module hook methods in these module bootstrap
> classes as they are already loaded. Then I could loop through these
> classes if some code wants to invoke some method, e.g. I have content
> form, then tag module can alter this form by adding input field for
> tags. If I remove or deactivate tag module, content form won't have
> tags field anymore. Same goes for handling the post data when saving
> content.
>
> Does this sound weird?
>
> br, Marko
>
> -----
> br,
> --------------------------
> Marko Korhonen
> Technical Consultant
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3071516.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-mvc] Re: Where are the module bootstraps objets saved?

Hi,

I did not mean resources like view, cachemanager etc.

I mean the module bootstrap classes. I have modules in my application
which all have extended from Zend_Application_Module_Bootstrap.

I would like to have module hook methods in these module bootstrap classes
as
they are already loaded. Then I could loop through these classes if some
code wants
to invoke some method, e.g. I have content form, then tag module can alter
this form by
adding input field for tags. If I remove or deactivate tag module, content
form won't have
tags field anymore. Same goes for handling the post data when saving
content.

Does this sound weird?

br, Marko

-----
br,
--------------------------
Marko Korhonen
Technical Consultant
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3071516.html
Sent from the Zend MVC mailing list archive at Nabble.com.