ZF2 feedback

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

ZF2 feedback

robertbasic
Hi all!

I've took some time tonight to play around with ZF 2 and thought about
writing down my first few notes on it.

It's up on github here: https://github.com/robertbasic/zf2phpplaneta

First, note that I didn't use the dev3 tag, but I took the current
HEAD (or whatever it's called) witch currently points to the
3442b2ed3874ca58cad24c53fbed6aff220f4aa3 commit, mainly because I want
to follow along with the development of the framework itself (as much
as time permits, but I hope I'll manage to put in 5 hours/week for
this. It's not a lot, I know.)

I used one of my existing ZF1 projects as the basis, as I intend to
rewrite this project in ZF2. The ZF1 project is this one:
https://github.com/robertbasic/phpplaneta

It took me about an hour and a half to make the homepage show
something, anything (I commented out the calls to the model, so the
view just simply shows a "No content" message). I didn't want to
"waste" time on figuring out things, as soon as I noticed that
something would require a bit more time and thinking, I just commented
out that piece and moved forward.

Autoloading:
The wiki page (http://framework.zend.com/wiki/display/ZFDEV2/Proposal+For+Autoloading+In+ZF2)
with the proposal helped a lot on this one. I used the
StandardAutoloader for now, as that seems the easiest to implement.
I'd love to try out the classmap loader next, will see how it turns
out.

Bootstrapping:
Nothing much to say about this, seems to me it's pretty much the same as in ZF1?

Registering action helpers:
Spent some 15 minutes on trying to basically have this line of code in ZF2:

Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH
.'/modules/public/controllers/helpers');

but couldn't figure it out. These helper brokers got a pretty big
overhaul, no? I tried to seek help on the wiki, but my internet
connection died :( typical.

Zend\Log seems to work fine.

Zend\Translator always threw an exception that the given adapter
doesn't exist and couldn't be loaded. Tried ArrayAdapter and Csv. I
suspect that my autoloader is not setup quite correctly.

View helpers/plugins:
I used the tests to realise there's this new way of accessing the view
helpers via $view->broker('helper_name'). This eliminates the calls to
the __call() method, yes? As for calling view helpers via this broker
method, how to call a "direct" method? E.g.
$view->broker('headTitle')->direct("ZF2"); ?
Also, old style $view->url() helper calls will be a bit tricky, as the
exception is thrown inside a href attribute and it's viewable only
when viewing the source of the page :)

Database:
So far I only connected to the database, no data
fetching/adding/updating... Zend\Db\Db.php, line 253 there's an echo
there :) also, may I suggest ucfirst() on the adapter name? :)

Zend\Controller\Router\Rewrite, line 97. There's a require_once call
there, but it's broken as I don't have the Zend lib on my include
path, I just used the StandardAutoloader. Commenting out that
require_once fixes it. Again, most likely my autoloader setup is
broken.

Hm, that's about it for now I think :)

Sorry for the bad Engrish, it's been a long day :)

Happy hackin'!

--
~Robert Basic;
http://robertbasic.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: ZF2 feedback

Adam Lundrigan
I've also been diving into the ZF2 codebase a bit lately.  From looking at
the zendframework/zf2 repo and watching conversations on IRC, I get the
impression that the bleeding-edge stuff isn't included in that "official"
repo yet.  Most of it is still in contributor forks and hasn't been merged
(this is the case for Zend\Locale, as I issued a pull request againt
zendfranework/zf2 to forwardport a patch from Zend_Locale and was pointed to
Thomas' zf2 fork).

I would like to see a ZF2 status page, on the wiki or elsewhere, where we
can go to see when a particular component was last merged into official repo
and a link to the contributor fork(s) (if they are public) where the
bleeding-edge work is taking place.  That would go a long way to helping
people like us get in early, watch the progress and offer feedback.

What I've been doing is trying out ZF2 standalone components using a basic
ZF1 app and a simple autoloader hack borrowed from Ralph to force namespaced
classes to be loaded from ZF2 and non-namespaced classes to be loaded from
ZF1.  So far I've only tested Zend\Di in this manner, and its working well
for me thus far.  That first sample app is on my GitHub:
https://GitHub.com/adamlundrigan/zf-examples

Basically I'm just watching the ml, irc and GitHub for word on components
that are in a workable state and then trying them out.

--
Adam Lundrigan, B.Sc, ZCE
[hidden email]

Sent from my Motorola Atrix smartphone
 On 2011-06-23 5:05 PM, "Robert Basic" <[hidden email]> wrote:
Reply | Threaded
Open this post in threaded view
|

Re: ZF2 feedback

derek miranda-2
I completely agree.

On Jun 23, 2011, at 4:09 PM, Adam Lundrigan wrote:

> I've also been diving into the ZF2 codebase a bit lately.  From looking at
> the zendframework/zf2 repo and watching conversations on IRC, I get the
> impression that the bleeding-edge stuff isn't included in that "official"
> repo yet.  Most of it is still in contributor forks and hasn't been merged
> (this is the case for Zend\Locale, as I issued a pull request againt
> zendfranework/zf2 to forwardport a patch from Zend_Locale and was pointed to
> Thomas' zf2 fork).
>
> I would like to see a ZF2 status page, on the wiki or elsewhere, where we
> can go to see when a particular component was last merged into official repo
> and a link to the contributor fork(s) (if they are public) where the
> bleeding-edge work is taking place.  That would go a long way to helping
> people like us get in early, watch the progress and offer feedback.
>
> What I've been doing is trying out ZF2 standalone components using a basic
> ZF1 app and a simple autoloader hack borrowed from Ralph to force namespaced
> classes to be loaded from ZF2 and non-namespaced classes to be loaded from
> ZF1.  So far I've only tested Zend\Di in this manner, and its working well
> for me thus far.  That first sample app is on my GitHub:
> https://GitHub.com/adamlundrigan/zf-examples
>
> Basically I'm just watching the ml, irc and GitHub for word on components
> that are in a workable state and then trying them out.
>
> --
> Adam Lundrigan, B.Sc, ZCE
> [hidden email]
>
> Sent from my Motorola Atrix smartphone
> On 2011-06-23 5:05 PM, "Robert Basic" <[hidden email]> wrote:


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


Reply | Threaded
Open this post in threaded view
|

Re: ZF2 feedback

robertbasic
In reply to this post by Adam Lundrigan
> I would like to see a ZF2 status page, on the wiki or elsewhere, where we
> can go to see when a particular component was last merged into official repo
> and a link to the contributor fork(s) (if they are public) where the
> bleeding-edge work is taking place.  That would go a long way to helping
> people like us get in early, watch the progress and offer feedback.

A status page would definitely be awesome to have. I did some more
coding this afternoon and for I have no idea what's the state of
Zend\View as for example there's no escape method/helper at the moment
or the fact that there's no concept of encoding in the current
PhpRenderer implementation.

--
~Robert Basic;
http://robertbasic.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: ZF2 feedback

robertbasic
> A status page would definitely be awesome to have. I did some more
> coding this afternoon and for I have no idea what's the state of
> Zend\View as for example there's no escape method/helper at the moment
> or the fact that there's no concept of encoding in the current
> PhpRenderer implementation.

Bah, stupid me. The escaping/encoding is in the Zend\View\Variables class.

--
~Robert Basic;
http://robertbasic.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: ZF2 feedback

weierophinney
Administrator
In reply to this post by robertbasic
-- Robert Basic <[hidden email]> wrote
(on Sunday, 26 June 2011, 06:46 PM +0200):

> > I would like to see a ZF2 status page, on the wiki or elsewhere, where we
> > can go to see when a particular component was last merged into official repo
> > and a link to the contributor fork(s) (if they are public) where the
> > bleeding-edge work is taking place.  That would go a long way to helping
> > people like us get in early, watch the progress and offer feedback.
>
> A status page would definitely be awesome to have. I did some more
> coding this afternoon and for I have no idea what's the state of
> Zend\View as for example there's no escape method/helper at the moment
> or the fact that there's no concept of encoding in the current
> PhpRenderer implementation.

Actually, there is. It's in the Variables class, which auto-escapes by
default, and has an escape() method. But this is entirely undocumented
currently -- these were hacks done to try and separate out the various
application concerns into discrete classes. More to come as we start
raising proposals/brainstorming on the View layer in the coming weeks.

--
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: ZF2 feedback

robertbasic
On Mon, Jun 27, 2011 at 5:05 PM, Matthew Weier O'Phinney
<[hidden email]> wrote:
> Actually, there is. It's in the Variables class, which auto-escapes by
> default, and has an escape() method. But this is entirely undocumented
> currently -- these were hacks done to try and separate out the various
> application concerns into discrete classes. More to come as we start
> raising proposals/brainstorming on the View layer in the coming weeks.

I've played a bit with the Variables and on this gist
https://gist.github.com/1066023 you can see an example how it's the
most convenient to use it at the moment, for me at least :)

As for the current implementation, it should enforce the usage of
Zend\View\Variables, as I can still do $this->view->foo in my
controller and "bypass" the whole Variables thing, which is bad cause
I'm left without escaping.

Also, what happens to arrays and objects assigned to the Variables?
They are assigned without escaping and something like <?php echo
$this->vars()->escape($foo); ?> isn't really fun to type.

I'll go over the Zend\View thread in the coming days and see if I can
offer some feedback there too, to keep it all in one place :)

--
~Robert Basic;
http://robertbasic.com/

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