data_structures
[ class tree: data_structures ] [ index: data_structures ] [ all elements ]

Class: DatabaseEntity

Source Location: /data_structures/DatabaseEntity.class.php

Class Overview

ABSTObject
   |
   --DatabaseEntity

Class to generate objects from database tables. It makes most sense to use this class as an abstract type.


Author(s):

Version:

  • 0.1.42

Copyright:

  • Copyright (C) 2006 Daniel Plücken <daniel@debakel.net>

    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License.

    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Variables

Methods


Inherited Methods

Class: ABSTObject

ABSTObject::printComplexData()
Prints out the more complex data by the given array.
ABSTObject::printPrimitiveData()
Prints out the primitive data by the given arrays.
ABSTObject::printStructure()
Prints out the Structure of this Object.
ABSTObject::same()
Checks whether the passed object reference points to this object.
ABSTObject::sameReferences()
Compares two references whether they points to the same object

Class Details

[line 53]
Class to generate objects from database tables. It makes most sense to use this class as an abstract type.

For example:

  1.  class Article extends DatabaseEntity
  2.  {
  3.       function Article$int_id null )
  4.       {
  5.             parent::DatabaseEntity$GLOBALS["dbt_article");
  6.  
  7.             if $int_id != null && is_numeric$int_id ) )
  8.             {   parent::initiateObjectFromTuple("id_article = '{$int_id}'")}
  9.       }
  10.  // end of class Article




Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  0.1.42
copyright:  

Copyright (C) 2006 Daniel Plücken <daniel@debakel.net>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

since:  0.9.1.5
license:  GNU Lesser General Public License


[ Top ]


Class Variables

$____dbt =  null

[line 68]

Stores the reference to an object of a database table.



Tags:

access:  public

Type:   ABSTDatabaseTable


[ Top ]

$____entity_arr = array()

[line 103]

Stores the references to other entities.



Tags:

access:  public

Type:   array


[ Top ]

$____key_arr = array()

[line 82]

Stores the key fieldnames.



Tags:

access:  public

Type:   array


[ Top ]

$____key_object_arr = array()

[line 96]

Stores the references to the objects of the key entities.



Tags:

access:  public

Type:   array


[ Top ]

$____key_table_arr = array()

[line 89]

Stores the references to the objects of the key database tables.



Tags:

access:  public

Type:   array


[ Top ]

$____parent_obj =  null

[line 61]

Stores the reference to an object of a database entity.



Tags:

access:  public

Type:   DatabaseEntity


[ Top ]

$____relation_arr = array()

[line 111]

Stores the references to other entities. But with a relation name as key in the first array dimension.



Tags:

access:  public

Type:   array


[ Top ]

$____str_where =  ""

[line 75]

Stores the where-clause to generate the data of this entity.



Tags:

access:  public

Type:   array


[ Top ]



Class Methods


static method createEntitiesFromMultiTuple [line 286]

static array createEntitiesFromMultiTuple( &$dbt_obj, string $str_where, [string $classname = __CLASS__], [boolean $primary_key_as_array_keys = false], ABSTDatabaseTable $dbt_obj)

Returns an array of this object. The objects are generated from a hurd of tuples collected from a result of a database query.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
author:  Daniel Dornhardt <daniel@dornhardt.com>
version:  1.22
since:  0.1.1
access:  public


Parameters:

ABSTDatabaseTable   $dbt_obj   Reference to the table from which the Tuple should read.
string   $str_where   Where-clause to fetch the tuple.
string   $classname   if used for subclasses of DatabaseEntity, class $classname is used for the construction objects so members / methods of subclass can be used
boolean   $primary_key_as_array_keys   If this is set to true, the keys of the output array will be the same like the primary key value for the matching tuple. THIS DOESN'T MAKE SENSE FOR ABSTView-OBJECTS!
   &$dbt_obj  

[ Top ]

constructor DatabaseEntity [line 127]

DatabaseEntity DatabaseEntity( &$dbt_obj, ABSTDatabaseTable $dbt_obj)

Constructor Put in a reference to an object which is a subtype of the type ABSTDatabaseTable or a reference to an object which is a subtype of the type ABSTView.



Tags:

version:  1.0
since:  0.1.0
access:  public


Parameters:

ABSTDatabaseTable   $dbt_obj  
   &$dbt_obj  

[ Top ]

method addEntity [line 200]

void addEntity( &$dbe, [string $named_relation = ""], DatabaseEntity $dbe)

Adds a weak entity.



Tags:

version:  1.1
since:  0.1.1
access:  public


Parameters:

DatabaseEntity   $dbe  
string   $named_relation   For example is_in_category ...
   &$dbe  

[ Top ]

method addKeyTable [line 174]

void addKeyTable( string $key, &$dbt_obj, ABSTDatabaseTable $dbt_obj)

Adds a keytable to this object.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  1.1
since:  0.1.1
access:  public


Parameters:

string   $key   Fieldname that refers to the key table.
ABSTDatabaseTable   $dbt_obj   Reference to the key table.
   &$dbt_obj  

[ Top ]

method addMultipleEntities [line 227]

void addMultipleEntities( &$dbt, string $str_key, [string $str_additional_where = ""], [string $named_relation = ""], ABSTDatabaseTable $dbt)

Describes an "n to m"-Relation to this object.



Tags:

version:  1.14
since:  0.1.1
access:  public


Parameters:

ABSTDatabaseTable   $dbt   Reference to the key table.
string   $str_key   Fieldname that refers to the key table.
string   $str_additional_where  
string   $named_relation   For example is_in_category ...
   &$dbt  

[ Top ]

method delete [line 364]

boolean delete( )

Trys to delete a dataset in the database table with values from the primary key.



Tags:

version:  1.0
since:  0.1.42
access:  public


[ Top ]

method initiateObjectFromTuple [line 151]

void initiateObjectFromTuple( string $str_where)

Initiates this object by using the data of a tuple from a database result.

The database table is managed by an object of the GilliGan-Framework. See in package databases for further information. The database tables object will be stored in the Field $____dbt of this object. The original fieldnames from the database table will be used for the fieldnames of this entity object. Beware, only the first found tuple will used for the initiation, therefore you better should use the primary key to grab the data from the underlying database table.




Tags:

version:  1.0
since:  0.1.0
access:  public


Parameters:

string   $str_where  

[ Top ]

method printStructure [line 552]

void printStructure( )

Prints out the Structure of this Object without the management data.



Tags:

author:  Daniel Plücken <daniel.pluecken@wfp2.com>
version:  1.0
since:  0.1.37
access:  public


Overrides ABSTObject::printStructure() (Prints out the Structure of this Object.)

[ Top ]

method putDatabaseFieldsIntoGetVars [line 525]

void putDatabaseFieldsIntoGetVars( )

Puts the fields of this Object, that correspond with the fields of database table, into the $_GET-Array.



Tags:

version:  1.0
access:  public


[ Top ]

method putDatabaseFieldsIntoPostVars [line 501]

void putDatabaseFieldsIntoPostVars( )

Puts the fields of this Object, that correspond with the fields of database table, into the $_POST-Array.



Tags:

version:  1.0
access:  public


[ Top ]

method putRequestValuesIntoObjectFields [line 440]

boolean putRequestValuesIntoObjectFields( [array $request_type_arr = array( "GET", "POST", "REQUEST" )])

Puts the values of the passed kind of request variables into the fields of this object. This is useful to update a dataset with entered form data before writing it back to the database table were it come from. Use the method "replace" to to so.



Tags:

version:  1.0
since:  0.1.4
access:  public


Parameters:

array   $request_type_arr  

[ Top ]

method replace [line 397]

boolean replace( )

Replaces this object in the database table.



Tags:

author:  Daniel Plücken <daniel@debakel.net> (auto_increment-handle)
author:  Daniel Dornhardt <daniel@dornhardt.com>
version:  0.12
since:  0.1.21
access:  public


[ Top ]


Documentation generated on Thu, 05 Jun 2008 23:42:41 +0200 by phpDocumentor 1.4.1