I've been trying to get my head round Zend Framework for some time now and I'm finding the massive ambiguity and total lack of answers really frustrating now.
I completed the quickstart tutorial a while ago, and using that as a basis for how things should be done I've tried to start doing my own project, a simple blogging platform. I find learning about the components I need to use to build my application very easy (the documentation works really well and is very simple to follow), but there seems to be no best practice, or no basic standard way of implementing things. This may well be for flexibility, but doesn't help people starting out, and neither does the over simplified and non-real-world examples in the documentation.
My current issue is in regards to Zend_Auth and Zend_ACL. It seems this is a common sticking point, as I have read lots of ways of how to implement this on forums, such as this and, and in tutorials, but all the proposed solutions don't really seem to fit with the layout and bootstrap provided with zf.sh.
Another field for utter confusion is the use of a Zend_Db adapter when using Zend_Auth_Adapter_DbTable. OK the basic idea is obvious, but I was plaining to use Zend_Db_Table_Abstract and mappers for the connection to the database in the same way the quickstart tutorial does, so why do I need to create/re-create a connection to the database (and probably store it in the registry) just for use with authenticating when the rest of my application won't use it. It seems I'm writing redundant code when I really shouldn't have too.
Does anyone know a blog/forum/tutorial that introduces these basic features of a web application and gives an example of how they should be implemented with an up-to-date version of the Zend Framework. I am actually running out of ideas on how to learn the bloody thing!
Annoyed with Zend
Moderator: General Moderators
-
marty pain
- Forum Contributor
- Posts: 105
- Joined: Thu Jun 11, 2009 5:32 am
- Location: Essex
Re: Annoyed with Zend
There is a front controller plugin to perform auth & acl checks to prevent access to controllers. I don't see how they could develop a 'standard' for using it? You define resources, roles, and give those roles access to those resources. Do you not understand what a resource is then?
Zend_Auth - you don't have use to have two connections. You can use your existing connection. Either put it where it checks in the static registry (under the global key 'db'), or pass it in as the first parameter when instantiating the dbTable auth adapter. This was right in the code examples:
http://framework.zend.com/manual/en/zen ... table.html Example 2:
An important thing to understand
Zend_Auth is a base class for your 'user'. It handles session related stuff per se.
Zend_Auth adapters handle logins, and are used by Zend_Auth
You can choose to use Zend_Auth if you want a 'full stack' user login system, or use the adapters directly if you want a 'low stack' framework
Zend_Auth - you don't have use to have two connections. You can use your existing connection. Either put it where it checks in the static registry (under the global key 'db'), or pass it in as the first parameter when instantiating the dbTable auth adapter. This was right in the code examples:
http://framework.zend.com/manual/en/zen ... table.html Example 2:
Code: Select all
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter
->setTableName('users')
->setIdentityColumn('username')
->setCredentialColumn('password')
An important thing to understand
Zend_Auth is a base class for your 'user'. It handles session related stuff per se.
Zend_Auth adapters handle logins, and are used by Zend_Auth
You can choose to use Zend_Auth if you want a 'full stack' user login system, or use the adapters directly if you want a 'low stack' framework
-
marty pain
- Forum Contributor
- Posts: 105
- Joined: Thu Jun 11, 2009 5:32 am
- Location: Essex
Re: Annoyed with Zend
Thanks Josh,
I get the individual components, I think I'm looking for a structured way of laying out the application as a whole. The code examples are fine, I'm just not sure where these would be written. A lack of experience in web application development makes picking the Zend Framework up a little tricky, as I'm unsure of the overall result I'm after. I feel I can get something working without to much trouble, but I keep thinking, "is this really the best way to do it?".
I'm just getting on with it now with help from a few books and people with more experience. Hopefully I'll find my own style after a few projects with Zend
I get the individual components, I think I'm looking for a structured way of laying out the application as a whole. The code examples are fine, I'm just not sure where these would be written. A lack of experience in web application development makes picking the Zend Framework up a little tricky, as I'm unsure of the overall result I'm after. I feel I can get something working without to much trouble, but I keep thinking, "is this really the best way to do it?".
I'm just getting on with it now with help from a few books and people with more experience. Hopefully I'll find my own style after a few projects with Zend
Re: Annoyed with Zend
Marty, I understand exactly what you're dealing with. If you're just getting into ZF it can be very frustrating. It's all very flexible and broken down in many smaller, (kind of) loosely coupled components. That's a strength, but also a problem if you're still in the steeper part of the learning curve. First, there are always many ways of doing things. So in one article something is written in the controller code, in the next in the bootstrap, in the next in some config file, yet another author creates a plugin and last there's someone who shows you how to extend a base class and write custom functionality yourself. If you just start, you just want to know what's a good, best practice way.
Second, the documentation is in general quite good in describing every bit. However, it's more like reading a dictionary. You can translate all words individually but understanding the story is very difficult. Let alone writing a story yourself.
Third, since the framework is not that old, some things have changed. So if you pick up a book one or two years old (written even longer ago) it's already dated.
There are a couple of blogs from people who write about ZF regularly which I find helpful
http://blog.astrumfutura.com/
http://akrabat.com/
http://weierophinney.net/matthew/
http://www.zendcasts.com
http://blog.ekini.net/
Second, the documentation is in general quite good in describing every bit. However, it's more like reading a dictionary. You can translate all words individually but understanding the story is very difficult. Let alone writing a story yourself.
Third, since the framework is not that old, some things have changed. So if you pick up a book one or two years old (written even longer ago) it's already dated.
There are a couple of blogs from people who write about ZF regularly which I find helpful
http://blog.astrumfutura.com/
http://akrabat.com/
http://weierophinney.net/matthew/
http://www.zendcasts.com
http://blog.ekini.net/
-
marty pain
- Forum Contributor
- Posts: 105
- Joined: Thu Jun 11, 2009 5:32 am
- Location: Essex
Re: Annoyed with Zend
Thanks matthijs,
I was starting to think that everyone else just got it and I was missing something! It's nice to hear that other people have had a similar experience. I started my learning using a book that was 2 years out of date, and I think that caused me a lot of problems. Not only was I trying to learn, but also trying to modernise at the same time. I have started using a new book that came out a couple of months ago.
http://www.zf-beginners-guide.com/
I've done the first couple of chapters and so far it's a nice soft start, and the list of resources on the site are good too. I have read that it goes off on a tangent when ORM is implemented but I'm not that far in yet. I'll post back after I get a little further.
I hope this helps other people too!
Thanks for the links! I'll have a good read!
I was starting to think that everyone else just got it and I was missing something! It's nice to hear that other people have had a similar experience. I started my learning using a book that was 2 years out of date, and I think that caused me a lot of problems. Not only was I trying to learn, but also trying to modernise at the same time. I have started using a new book that came out a couple of months ago.
http://www.zf-beginners-guide.com/
I've done the first couple of chapters and so far it's a nice soft start, and the list of resources on the site are good too. I have read that it goes off on a tangent when ORM is implemented but I'm not that far in yet. I'll post back after I get a little further.
I hope this helps other people too!
Thanks for the links! I'll have a good read!
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: Annoyed with Zend
The two sites that helped me the most when I was in your shoes were:
http://www.survivethedeepend.com/
http://www.zendcasts.com
The former is made by a developer on these forums and is WONDERFUL, just wish he'd make a pdf already for my ipad (Won it for free... else I would've bought an Android tablet).
http://www.survivethedeepend.com/
http://www.zendcasts.com
The former is made by a developer on these forums and is WONDERFUL, just wish he'd make a pdf already for my ipad (Won it for free... else I would've bought an Android tablet).