ZF 2.0 tutorials?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

ZF 2.0 tutorials?

Mike A
My task: to convince three excellent PHP programmers to take more than a
cursory look at ZF2.0, so they are willing to engage in training.
My reason: I *would like to employ ZF2.0* for proofing a major project
rather than make it the 9th project directed away from ZF.
My problem: insufficient easy-to-use material to display how to get a
basic project up and running.

I've tried "Getting started with Zend Framework 2.0", with nice
explanations by Rob Allen. Unfortunately, the
https://github.com/zendframework/ZendSkeletonApplication example
referred to by Rob doesn't seem to work.[1]  Therefore looking for other
tutorials so I can quickly/crisply show intelligent people a fast set-up
from scratch. Worked through the Wiki, not having much luck though.



[1]  Configuration error on first page load:  Catchable fatal error:  
Argument 1 passed to Zend\Config\Config::merge() must be an instance of
Zend\Config\Config, array given, called in
E:\xampp-1x7x7\htdocs\zf2tutorial\library\Zend\Module\Manager.php on
line 493 and defined in
E:\xampp-1x7x7\htdocs\zf2tutorial\library\Zend\Config\Config.php on line
387.



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

denniswinter

> [1]  Configuration error on first page load:  Catchable fatal error:  Argument 1 passed to Zend\Config\Config::merge() must be an instance of Zend\Config\Config, array given, called in E:\xampp-1x7x7\htdocs\zf2tutorial\library\Zend\Module\Manager.php on line 493 and defined in E:\xampp-1x7x7\htdocs\zf2tutorial\library\Zend\Config\Config.php on line 387.

I assume that this error occurs in the getConfig() method of your Module.php file. The solution is:
return new Zend\Config\Config(include(__DIR__.'/configs/module.config.php'));

I recently stumbled upon this one.. So maybe Rob should fix this in his tutorial!
>

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

Jurian Sluiman
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

Mike A
On 12/11/2011 13:52, Jurian Sluiman wrote:

> On Saturday 12 November 2011 13:30:46 Dennis Winter wrote:
>> I assume that this error occurs in the getConfig() method of your
>> Module.php file. The solution is: return new
>> Zend\Config\Config(include(__DIR__.'/configs/module.config.php'));
>>
>> I recently stumbled upon this one.. So maybe Rob should fix this in his
>> tutorial!
> On 2 november the zf2 library changed to return arrays and Traversable
> instances as well. You do not need to return a Zend\Config\Config anymore, but
> arrays (as the ZendSkeletonApplication uses) are also fine now.
>
> This rather means the library included in the app is outdated and should be
> updated to the latest version. If you have a cloned ZendSkeletonApplication
> running with zf2 as submodule, just do this:
>
> cd library/ZendFramework&&  git pull origin master
>
> This will make your modules work again. This was the commit with the change:
> https://github.com/zendframework/zf2/commit/837e347bd432561f05ae7142c5142591950ab1f0#library/Zend/Module/Manager.php
>
> --
> Jurian Sluiman
>
>
[Sent by mistake to Jurian direct: is it possible to set headers for
reply to the list instead of the list member?]


Thanks, both, for feedback (and that arriving off-list).

FWIW, I did not use the included library but the latest from
https://github.com/zendframework/zf2/downloads.

This type of situation displays why I needed to ask for tutorials.
Whilst understanding that ZF 2.0 has some way to go, convincing serious
investors (who at this time of year seek potential projects) that some R
& D to prove a technology requires something to show its coming to the
real world. With that in mind I shall next week speak with capable
developers who in turn will voice opinions as to whether to give ZF 2.0
a chance of an "in bunker" proving exercise.[1]

"In bunker"?  Lease a large homely property (possibly mansion) somewhere
in Scotland, full accommodation for developers, housemaid service (okay,
bad grammar: no wise-cracks please), and engage in project from 1st
December to end-Feb. If the project's provable, then continue with team.
A sort of developer's heaven without pizza delivery.

If I were to refer the example tutorial, and potential developers saw
what was identified in this thread, then from a strategy planning
perspective the project would be dead at the proposal stage.

Anyone have links to other ZF 2.0 tutorials for me to build an armoury?
Please!


[1]  R&D project open to list members too if they have three months to
spare.

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

Mike A
In reply to this post by Jurian Sluiman
On 12/11/2011 13:52, Jurian Sluiman wrote:

> On Saturday 12 November 2011 13:30:46 Dennis Winter wrote:
>> I assume that this error occurs in the getConfig() method of your
>> Module.php file. The solution is: return new
>> Zend\Config\Config(include(__DIR__.'/configs/module.config.php'));
>>
>> I recently stumbled upon this one.. So maybe Rob should fix this in his
>> tutorial!
> On 2 november the zf2 library changed to return arrays and Traversable
> instances as well. You do not need to return a Zend\Config\Config anymore, but
> arrays (as the ZendSkeletonApplication uses) are also fine now.
>
> This rather means the library included in the app is outdated and should be
> updated to the latest version. If you have a cloned ZendSkeletonApplication
> running with zf2 as submodule, just do this:
>
> cd library/ZendFramework&&  git pull origin master
>
> This will make your modules work again. This was the commit with the change:
> https://github.com/zendframework/zf2/commit/837e347bd432561f05ae7142c5142591950ab1f0#library/Zend/Module/Manager.php
>
>

Worked, thanks -- set up a separate Git repo to keep on track with ZF
2.0 development. Then came across the following after an exception
thrown in the tutorial.

Zend\Mvc\Router\Http\TreeRouteStack.php

     public function assemble(array $params = array(), array $options =
array()) <<<<<< $options as array
     {
         if (!isset($options['name'])) {
             throw new Exception\InvalidArgumentException('Missing
"name" option');
         }

         $names = explode('/', $options['name'], 2); <<<<<<

$options['name'] arrives as an array instead of text, from the view
(index.phtml) code...
echo $this->url(array('controller'=>'album', 'action'=>'add'),
array('name' => 'default'));

Can supply more if needed.



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

Mike A
In reply to this post by Jurian Sluiman
Following on from my last email...

Zend\Mvc\Router\Http\TreeRouteStack.php
     public function assemble(array $params = array(), array $options =
array())
     {
         if (!isset($options['name'])) {
             throw new Exception\InvalidArgumentException('Missing
"name" option');
         }

         $names = explode('/', $options['name'], 2);
         $route = $this->routes->get($names[0]);

Does not work. Changing "if (!isset($options['name'])) {"  and "$names =
explode('/', $options['name'], 2);" to check/explode $params instead of
$options works...

     public function assemble(array $params = array(), array $options =
array())
     {
         if (!isset($params ['name'])) {
             throw new Exception\InvalidArgumentException('Missing
"name" option');
         }

         $names = explode('/', $params ['name'], 2);
         $route = $this->routes->get($names[0]);

Seems that either the above change needs incorporating or something back
down the line needs treatment. If change to the above then the
InvalidArgumentException message would also need change.

Could someone take a look at this and process it through the formal
development cycle? I'm not being lazy -- simply accepting there are
better heads than mine for this deep level stuff.

Caveat:  Wearing my Monday morning head -- two brain cells are not fully
cooperating yet. If I haven't explained it well then please have pity.

Mike A.

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

weierophinney
Administrator
-- Mike A <[hidden email]> wrote
(on Monday, 14 November 2011, 12:30 PM +0000):

> Following on from my last email...
>
> Zend\Mvc\Router\Http\TreeRouteStack.php
>     public function assemble(array $params = array(), array $options
> = array())
>     {
>         if (!isset($options['name'])) {
>             throw new Exception\InvalidArgumentException('Missing
> "name" option');
>         }
>
>         $names = explode('/', $options['name'], 2);
>         $route = $this->routes->get($names[0]);
>
> Does not work. Changing "if (!isset($options['name'])) {"  and
> "$names = explode('/', $options['name'], 2);" to check/explode
> $params instead of $options works...
>
>     public function assemble(array $params = array(), array $options
> = array())
>     {
>         if (!isset($params ['name'])) {
>             throw new Exception\InvalidArgumentException('Missing
> "name" option');
>         }
>
>         $names = explode('/', $params ['name'], 2);
>         $route = $this->routes->get($names[0]);
>
> Seems that either the above change needs incorporating or something
> back down the line needs treatment. If change to the above then the
> InvalidArgumentException message would also need change.

Two things:

 * For ZF2, please use the zf-contributors mailing list. Since it's not
   considered stable yet, we're answering most questions in that
   location.

 * Can you explain exactly what's not working, in the form of a test
   case? As in: "given this code, I expect this result, but I'm getting
   this result instead." This will make it _much_ easier for us to
   determine what the issue is, and whether or not it's been addressed.

Thanks!

> Could someone take a look at this and process it through the formal
> development cycle? I'm not being lazy -- simply accepting there are
> better heads than mine for this deep level stuff.
>
> Caveat:  Wearing my Monday morning head -- two brain cells are not
> fully cooperating yet. If I haven't explained it well then please
> have pity.

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

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 tutorials?

omerida
In reply to this post by Mike A
I've found these to be helpful in porting a ZF1 app to ZF2:

Rob Allen's tutorial - worked for me out of the box using git submodule
http://akrabat.com/getting-started-with-zend-framework-2/

The programmers reference manual for groking new concepts, although
sometimes it takes a couple of reads.
http://packages.zendframework.com/docs/latest/manual/en/index.html

This module helped me figure out how to use DI and how to structure a
functional module.
https://github.com/EvanDotPro/EdpUser

Hope this helps!

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]