SpiffyJr's Blogaroo

Happenings of the man known as SpiffyJr

  • Home
  • About
    • Inspiration
    • Resume
  • Projects
    • Blitzaroo
    • phpRaider
    • Zend Calendar
  • Docs
    • Blitzaroo API
    • SpiffyCalendar Docs
    • SpiffyDb Docs
  • Downloads
  • Technologies
    • Doctrine ORM
    • Dojo
    • PHP
    • Zend Framework
  • Other
    • License
Twitter RSS
Category Archives: Zend Framework

SpiffyModel/Mapper for Zend Framework

Posted on September 14, 2009 by SpiffyJr
3 comments

The Delima

Creating a model/mapper for every (or near every) table in your database can be a time consuming process. I got rather bored copying/pasting virtually identical models/mappers so I wrote a couple classes that handle the majority of the work for me and add some nifty features.

The Solution

Spiffy_Db_Model, Spiffy_Db_Model_Mapper, and Spiffy_Db_Table provide the basic functionality of your most common model/mapper. Methods such as findByField, find, fetchAll, fetchAllByField, getOptions, setOptions, lastInsertId, select and automatic getters/setters make it simple to start using. All that’s required is you extend the appropriate Spiffy_Db_XXXX_Abstract class and you’re off. The one expectation is that you use a lowercase and underscore spaced naming convention for your tables. i.e., user_id and not UserId.

Getting It

Coming soon… comment if you’re interested.

GD Star Rating
loading...
Categories: SpiffyDb, Zend Framework | Tags: database, mapper, model, php, zend

Zend Calendar for the Zend Framework

Posted on September 13, 2009 by SpiffyJr
5 comments
Finding a Calendar

I ran into a situation this weekend where I needed a calendar for Zend_Framework. I spent an hour or so searching but couldn’t find anything that fit my tastes so I made my own. My calendar uses Zend_Date and Zend_Locale and is truly Zendy (new word?). It uses a view script to generate the calendar so it’s completely customizable and cssable (another new word?). I call it SpiffyCalendar and it will be available shortly once I wrap up licensing and a few finishing touches.

Features

  • Completely integrated as a library package for Zend Framework.
  • Utilizes Zend_Date and Zend_Locale provided by the Zend Framework.
  • Rendered using different adapters (ships with Zend_View and a view script).
  • Released under the GNU GPL license
  • Support for adding events/appointments.
  • Easily AJAXified

Example

Simple Calendar

SpiffyCalendar - Simple Example

SpiffyCalendar - Simple Example

GD Star Rating
loading...
Categories: Zend Calendar, Zend Framework | Tags: calendar, php, zend

Using column names in Zend_Db_Adapter update()

Posted on September 11, 2009 by SpiffyJr
2 comments

I’m doing an adjacency list model for a hierarchical menu system and while doing the sorting of menu items I ran into an issue with Zend_Db_Adapter::update().

public function up($cls)
{
	$table = $this->getDbTable();
	$adapter = $table->getAdapter();

	$data = array('priority' => 'priority - 1');

	$where = array($adapter->quoteInto('id = ?', $cls->getId()));
	$table->update($data, $where);
}

When the up() method is ran it sets the priority field to 0 which is incorrect. The code below which was written manually works as expected.

public function up($cls)
{
	$table = $this->getDbTable();
	$adapter = $table->getAdapter();

	// Works fine
	$sql = "UPDATE `menu` SET priority = (priority-1) WHERE id = " . $cls->getId();
	$adapter->query($sql);
}

Perhaps I’m not using the function properly but this is an oddity that should be addressed.

GD Star Rating
loading...
Categories: Zend Framework
Page 4 of 4«1234
  • Recent Posts

    • Keep your Git fork clean
    • Get started with Zend Framework 2 modules!
    • More Doctrine 2 and Zend Framework integration goodies!
    • Super sexy URLs with ZF and the joy of controller plugins!
    • Formatting your API to work with dojox.data.JsonRestStore (#dojo)
  • Categories

    • Other
      • Random
    • Projects
      • Blitzaroo
      • phpRaider
      • SpiffyDb
      • View Helpers
      • Zend Calendar
    • SpiffyJr
    • Technologies
      • Dojo
      • PHP
      • Zend Framework
  • Tag Cloud

      Ajax Algorithm api Blitzaroo Blog BSD licenses calendar Cascading Style Sheets CSS database Data Formats Dojo Dojo Toolkit event Framework game Google HTML HTML element JavaScript JQuery json Languages mapper Marketing mmorpg model php Programming Projects Scripts Source code Style sheet Style Sheets Twitter Website zend Zend Framework
  • Archives

    • December 2011
    • November 2011
    • July 2011
    • April 2011
    • March 2011
    • December 2010
    • November 2010
    • October 2010
    • March 2010
    • February 2010
    • November 2009
    • October 2009
    • September 2009
© SpiffyJr's Blogaroo. Proudly Powered by WordPress | Nest Theme by YChong