<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 17:37:06 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Evan Coury's Blog: Sharing a database connection across modules in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/17876</guid>
      <link>http://www.phpdeveloper.org/news/17876</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post to his site about a handy method for <a href="http://blog.evan.pro/sharing-a-database-connection-across-modules-in-zend-framework-2">sharing database connections across modules</a> in a Zend Framework application.
</p>
<blockquote>
With the new modular infrastructure in Zend Framework 2, one of the most common questions will indoubitably be how to share a database connection across modules. Here's a quick explanation of how to share your database connection across multiple modules in a way that can even allow you to use a single connection between ZendDb, Doctrine2, and possibly even other database libraries / ORMs.
</blockquote>
<p>
He includes the code in the post to configure this application-wide database resource, a "masterdb_pdo" that uses a MySQL backend. This configuration is used to set up the connection in a dependency injection container for later (globalish) use. He also mentions something similar about sharing Doctrine connections with the ZendDb components (using the same DI container approach).
</p>]]></description>
      <pubDate>Fri, 27 Apr 2012 09:54:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: One-to-Many Joins with Zend_Db_Table_Select]]></title>
      <guid>http://www.phpdeveloper.org/news/17515</guid>
      <link>http://www.phpdeveloper.org/news/17515</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has a tip for the Zend Framework users out there using the Zend_Db module to connect to their database resources - how to do a <a href="http://akrabat.com/zend-framework/one-to-many-joins-with-zend_db_table_select/">one to many join</a> with the help of Zend_Db_Table_Select (easier than it sounds).
</p>
<blockquote>
Let's say that you want to set up a one-to-many relationship between two tables: Artists and Albums because you've refactored my <a href="http://akrabat.com/zend-framework-tutorial">ZF1 tutorial</a>. [...] Assuming you're using Zend_Db_Table, the easiest way is to turn off the integrity check and do a join in a mapper or table method.
</blockquote>
<p>
He includes a few lines of source to illustrate, calling the "setIntegrityCheck" value to "false" to tell ZF not to worry about the additional join value over to the artists table. The result is a new column value with the artist's name instead of just the ID.
</p>]]></description>
      <pubDate>Wed, 08 Feb 2012 09:28:20 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Till Klampaeckel's Blog: Zend Framework: Writing an IN-Clause with Zend_Db]]></title>
      <guid>http://www.phpdeveloper.org/news/15612</guid>
      <link>http://www.phpdeveloper.org/news/15612</link>
      <description><![CDATA[<p>
In <a href="http://till.klampaeckel.de/blog/archives/129-Zend-Framework-Writing-an-IN-Clause-with-Zend_Db.html">a new post</a> to his blog <i>Till Klampaeckel</i> looks at something the Zend Framework's Zend_Db component dosen't seem to support - an "IN" on a fetchAll - and how he worked around it.
</p>
<blockquote>
The IN-clause is only supported when I wrap my statement with Zend_Db_Select, which is something I rarely do. Part of the reason is that I still don't feel comfortable writing my SQL in a DSL which doesn't really do anything besides wrapping a string into an object and IMHO it doesn't add to readability either. And the other reason is that I don't plan to run this import against any other database than MySQL. Which is why I don't see the need for abstraction either.
</blockquote>
<p>
He shows some failing code where the IN isn't populated correctly when an array is passed in and the warnings that come with it. He solution's pretty simple, though - rewrite the query string before sending it with the correct number of bind locations ("?") for the number of parameters. In the comments, other approaches are suggested including using a simple select() call or tricking the bindings with a special kind of array. 
</p>]]></description>
      <pubDate>Tue, 21 Dec 2010 13:16:07 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: SqlSrv v2 and long field names]]></title>
      <guid>http://www.phpdeveloper.org/news/15332</guid>
      <link>http://www.phpdeveloper.org/news/15332</link>
      <description><![CDATA[<p>
In <a href="http://akrabat.com/php/sqlsrv-v2-and-long-field-names/">this latest post to his blog</a> <i>Rob Allen</i> takes a look at a problem he had when installing a project that used SQL Server as its data source - it just didn't work.
</p>
<blockquote>
A good proportion of the projects my company undertakes end up on Windows servers with IIS and SQL Server and hence we use the SqlSrv PHP extension  from Microsoft. We don't host any of these projects ourselves and leave it up to the client's IT department. This is the main reason that we use a database abstraction layer, Zend_Db, in our case as we can swap the underlying database out with less hassle. A couple of weeks ago, I came across a problem when installing our app onto the client's server. It didn't work. This was a surprise as we have a few Windows Server VMWare installations on which we had tested and they had worked fine. 
</blockquote>
<p>
He ultimately boiled it down to an exception from the SQL Server - "String data, right truncation". As it turns out, with the version 2 of the sqlsrv driver, you can't have a field name longer than 30 characters. There's two obvious workarounds - shorten the field name or use a PDO interface. Since one doesn't exist (well, not formally) he <a href="http://github.com/akrabat/Akrabat/blob/master/zf1/Akrabat/Db/Adapter/Pdo/Sqlsrv.php">created his own</a> you can drop into your application if you have the need. 
</p>]]></description>
      <pubDate>Mon, 25 Oct 2010 13:03:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPRiot.com: Zend Framework 101: Zend_Oauth]]></title>
      <guid>http://www.phpdeveloper.org/news/14752</guid>
      <link>http://www.phpdeveloper.org/news/14752</link>
      <description><![CDATA[<p>
On PHPRiot.com <i>Quentin Zervaas</i> has posted <a href="http://phpriot.com/articles/twitter-authentication-zend-oauth">the latest article</a> in his "Zend Framework 101" series that talks about several of the more well-used components of the framework. This time he take a look at the Zend_Oauth component that allows your application to talk with remove OAuth service.
</p>
<blockquote>
To demonstrate how to use this component, we're going to create a basic script that allows a user to log in to their Twitter account and post a status update. Twitter is currently phasing out "basic authentication" and requiring all third-party web and desktop applications use OAuth. This article can be used as a starting point for creating (or updating existing) Twitter API apps. We will also be using the Zend_Service_Twitter component, as I covered in a <a href="http://phpriot.com/articles/php-twitter-api-screencast">previous screencast</a>.
</blockquote>
<p>
He talks some about <a href="http://phpriot.com/articles/twitter-authentication-zend-oauth/2">how OAuth works</a> and how to use the component, along with Zend_Db, to create a simple comsumer script that connects to Twitter and posts a message to Twitter as the user that's authenticated.
</p>]]></description>
      <pubDate>Tue, 06 Jul 2010 13:20:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[php|architect: Zend Db 2.0 Kicks Off ]]></title>
      <guid>http://www.phpdeveloper.org/news/14713</guid>
      <link>http://www.phpdeveloper.org/news/14713</link>
      <description><![CDATA[<p>
As is mentioned on the php|architect blog today (from <i>Bill Karwin</i>) the requirements gathering stage for the Zend_Db 2.0 version of the database component for the Zend Framework has started. <i>Ralph Schindler</i> has <a href="http://www.phparch.com/2010/06/25/zend-db-2-0-kicks-off">issued a document</a> talking about some of the issues that have come up in the component's past.
</p>
<blockquote>
Requirements have been solicited from both community members in various conversations, as well as looking through the issue tracker for feature requests that have been on the backlog due to potential BC breakage. This document reflects those ideas, and it's now in a position where we'd like to start a discussion on the direction outlined inside it.
</blockquote>
<p>Suggested features include things like:</p>
<ul>
<li>Pluggable architecture
<li>Distinct abstractions
<li>Addition of a Metadata sub-component
<li>Better testability in the Unit Tests
<li>Base Plugins / Type Converter
</ul>]]></description>
      <pubDate>Mon, 28 Jun 2010 12:09:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[phpRiot.com: Fetching Data With Zend_Db]]></title>
      <guid>http://www.phpdeveloper.org/news/14312</guid>
      <link>http://www.phpdeveloper.org/news/14312</link>
      <description><![CDATA[<p>
<i>Quentin Zervaas</i> has posted a new tutorial on phpRiot.com today with a quick look at <a href="http://www.phpriot.com/articles/fetch-data-with-zend-db">using Zend_Db</a> to pull information out of your database.
</p>
<blockquote>
In this PhpRiot Snippet I will show you a couple of different ways to fetch data when using the Zend Framework's Zend_Db component. Zend_Db is a useful database abstraction class that comes with the Zend Framework. This article assumes you have already established a database connection and you have tables to select data from.
</blockquote>
<p>
They show you how to fetch a single value from a table, grab all of the records from a specific column, getting more than one column and grabbing all of the contents of a table and returning them to your script with a "fetchAll" method call.
</p>]]></description>
      <pubDate>Wed, 07 Apr 2010 11:13:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Content with Style Blog: Zend Framework DB and Mysql pre 5.17]]></title>
      <guid>http://www.phpdeveloper.org/news/13364</guid>
      <link>http://www.phpdeveloper.org/news/13364</link>
      <description><![CDATA[<p>
The Content with Style blog has <a href="http://www.contentwithstyle.co.uk/content/zend-framework-db-and-mysql-pre-5.17">a gotcha</a> that Zend Framework developers could come across if they're using MySQL pre-5.17:
</p>
<blockquote>
was getting weird errors when running multiple queries with Zend Framework, that I just couldn't replicate on my local environment. [...] Turns out the server runs MySQL pre 5.17.
</blockquote>
<p>
This caused a stack trace error where the queries wouldn't run correctly. The solution was (like the error message suggests) turning on query buffering with the "PDO::MYSQL_ATTR_USE_BUFFERED_QUERY" in the PDO connection's parameters. You can find out more information about the parameters you can pass to the adapter in <a href="http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.parameters">this section</a> on the Zend Framework' Zend_Db manual page.
</p>]]></description>
      <pubDate>Fri, 09 Oct 2009 10:33:12 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ralph Schindler's Blog: Database Abstraction Layers Must Live!]]></title>
      <guid>http://www.phpdeveloper.org/news/12879</guid>
      <link>http://www.phpdeveloper.org/news/12879</link>
      <description><![CDATA[<p>
In response to <a href="http://www.phpdeveloper.org/news/12850">this older post</a> <i>Ralph Schindler</i> has posted some of <a href="http://ralphschindler.com/2009/07/15/database-abstraction-layers-must-live">his own thoughts</a> on database abstraction layers - they must live!
</p>
<blockquote>
Interestingly, I can put the vocal proponents of each side of the argument in one of two boxes: a programmer guy box, or a database guy box. For some unknown reason though, they never seem to see eye to eye. [...] Generally speaking of database driven projects, I feel like planning to use a specific vendor up front, knowing its pro's and con's, and tailoring an application to the chosen database's strengths can only help in the long run. Also, I feel that building a database model first before any code, offers many performance and scalability advantages than does code first development.
</blockquote>
<p>
He notes that, while he agrees on the problems with the "switching databases at any time" problems the other author brings up, he points out that the abstraction layers do have their place. He includes an example of an abstraction layer with the Zend_Db object of the Zend Framework. His sample code shows how it can be used to simplify your interaction with your database.
</p>]]></description>
      <pubDate>Wed, 15 Jul 2009 14:16:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPRiot.com: Zend Framework 101: Zend_Registry]]></title>
      <guid>http://www.phpdeveloper.org/news/12138</guid>
      <link>http://www.phpdeveloper.org/news/12138</link>
      <description><![CDATA[<p>
The "Zend Framework 101" series continues on the PHPRiot.com blog with <a href="http://www.phpriot.com/articles/zend-registry">this new look</a> at the Zend_Registry component.
</p>
<blockquote>
In this article in the Zend Framework 101 series I will introduce you to the Zend_Registry class. This class used is to allow you manage variables and objects in the global application namespace. This is used as an alternative to using global variables in PHP. I will show you how to use the Zend_Registry class and also provide a practical example of where it would be useful to use the registry.
</blockquote>
<p>
You'll need a copy of <a href="http://framework.zend.com/">the framework</a> already up and working to follow along (no installation support here). His "real life" example - a quick fifteen lines of code - shows how to pull a Zend_Db database instances back out of a Zend_Registry object.
</p>]]></description>
      <pubDate>Mon, 16 Mar 2009 08:47:51 -0500</pubDate>
    </item>
  </channel>
</rss>
