PHP Classes
Icontem

File: readme.txt


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  TypeSafeStruct  >  readme.txt  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: readme
Class: TypeSafeStruct
Manipulate type safe objects
 

Contents

Class file image Download
There are some attempts to build type safe php objects, but they all have lacks on working with eaccelarator, when they check against phpdoc comments as type safety validation notation. 
E.g. POPO (plain old php objects) from http://jan.kneschke.de/projects/typesafe-objects-in-php validates 
against the doc comment of the reflected object. But when the object is bytecoded by eAccelarator all comments 
are removed from the source. Means: "type safe" properties loose their information and the object does not work any more.

This class set is an attempt to fix this lack.
Look at the sample (auto-generated db model struct class file) and see how it works.

All object properties have their own dynamic getters and setters. So, if you have a db column named caption, then you can set a value by simply writing (when the object is instantiated): $o->setCaption("my value").

Properties of a model class do only need a type prefix in front of the property name. Supported type prefixes for now:
- string (varchar, char, text, etc.)
- float (real,decimal,float)
- integer (int,smallint,bigint,etc.)
- bool (tinyint,bool)
- array (enum)


How do I insert a value?

Valid setValue sample:
$clsObject = new Model_Objects_Countries;
$clsObject->setContinent("Asia");

Invalid setValue sample:
$clsObject = new Model_Objects_Countries;
$clsObject->setContinent(true);

If you try to set an invalid value then an exception will thrown



How do I get a value?

$clsObject = new Model_Objects_Countries;
$clsObject->getContinent();


Once an object is filled, you can use the SerializeTypeStruct class
to convert your object into different output formats.

SerializeTypeStruct provides only two formats for giving you
an image of what can be done.

You can implement any kind of output format (CSV, PDF, XLS and so on), but you have to write it on your own.

Regards Tom

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products