xuServer  4.2
xuServer est un Framework ORM écrit en PHP pour des bases de données MySQL.
Public Member Functions | Data Fields
xsClass Class Reference

This Class is the fundamental class of the framework and holds the final ORM object. More...

Inheritance diagram for xsClass:
xsComponent xsModel xsConcept xsCollection xsProperty

Public Member Functions

 __construct ()
 
 __invoke ($sql="")
 
 __call ($funcName, $arguments)
 
 __toString ()
 
 val ($arr="_POST")
 
 upload ()
 
 create ($input="")
 create an instance of the current object in database More...
 
 read ()
 
 update ($input="", $value="")
 
 delete ()
 
 copy ()
 
 find ($criteria="__NOTHING__")
 
 each ($pfunc)
 
- Public Member Functions inherited from xsComponent
 addButton ($name="name", $value="", $label="__label", $CRUD="1111")
 
 addMethod ($name="name", $label="label", $container="xs-fn-footer")
 
 _form ($method="")
 builds and returns the html code for object formular More...
 
 _formCreate ()
 
 _formRead ()
 
 _formUpdate ()
 
 _formDelete ()
 
 _logo ($height="35")
 
 _icon ()
 
 _list_group_item ()
 
 _thumbnail ()
 
 _table ($sql="")
 
- Public Member Functions inherited from xsModel
 init ()
 
 load ($id="")
 
 build ($mci="", $debug=false)
 
 sql ($criteria="__NOTHING__")
 
 sql_create ()
 
 sql_read ()
 
 sql_update ()
 
 sql_delete ()
 
 sql_copy ()
 
 sql_each ()
 
 sql_stats ()
 
 sql_search ($term="")
 
 stats ($pFunc="")
 
 count ()
 
 sum ()
 
 min ()
 
 max ()
 
 avg ()
 
 percent ()
 
 every ()
 
 any ()
 
 CRUD ($CRUD="")
 
- Public Member Functions inherited from xsConcept
 mciparse ($string="")
 this method parses the given string parameter to determine the module name the concept name and the id of the object More...
 
 privilege ($key="")
 
 foldername ($autocreate=false)
 
 design_readclass ()
 
 design_constructor ()
 

Data Fields

 $properties =array()
 array of xsProperties More...
 
 $methods =array()
 array of xsMethods (end user public methods) More...
 
 $collections =array()
 array of xsCollections More...
 
 $uploading =false
 boolean that determines if a file is uploaded with the posted _form More...
 
 $_selectionType = "__NOTHING__"
 
- Data Fields inherited from xsModel
 $db_table ="xam_user"
 name of the table in Database that stores class instances More...
 
 $db_index =""
 name of table field that stores the auto_increment primary key More...
 
 $db_title =""
 name of table field that stores the class title if not specified before using xsClass::load(), the second table column is used More...
 
 $is_built =false
 flag to test if object has been build (metadata, methods ...) More...
 
 $title ="__notitle__"
 this property stores the common name given to an instance of the class More...
 
 $name ="__notitle__"
 this property stores : More...
 
 $can_create =1
 can user create concept instance More...
 
 $can_read =1
 can user read concept instance More...
 
 $can_update =1
 can user update concept instance More...
 
 $can_delete =1
 can user delete concept instance More...
 
 $can_search =1
 can user search concept instance More...
 
 $sql_load_alias =Array()
 
- Data Fields inherited from xsConcept
 $mci =""
 identification of the class concatenation of module_concept_dbid More...
 
 $module ="xam"
 name of the module that deals with the object held by xsClass (convention : word before the first "_" in tablename) More...
 
 $concept ="user"
 name of the class beeing held by xsClass. concept is the name of the php class that extends metaclass xsClass More...
 
 $includeFile =""
 path to the business class file if exists More...
 
 $logoPath =""
 path to the logo of current class More...
 
 $privilegeKey =""
 privilege name defined on child classes More...
 
 $db_id =0
 unique identifyer of primary key, instance number of the class More...
 

Additional Inherited Members

- Protected Member Functions inherited from xsComponent
 addProperty ($name="name", $value="", $label="__label", $CRUD="1111")
 
 addCollection ($table, $fk_index)
 
 onMetadata ()
 
 onBeforeMetadata ()
 
 onBuildMethods ()
 
 onInstance ()
 
 onBeforeInstance ()
 
 onInstanceFail ()
 
 onBeforeUpdate ()
 
 onUpdate ()
 
 _fieldset ($ajax=true)
 
 _iconCRUD ($crud="", $class="success")
 
- Protected Member Functions inherited from xsModel
 instance ($stmt, $collections="__NONE__")
 
 build_sql ()
 
 build_collections ($criteria="__NOTHING__")
 
- Protected Member Functions inherited from xsConcept
 mciSet ()
 
- Protected Attributes inherited from xsModel
 $sql_statement =""
 last build sql statement : More...
 
 $sql_statement_create =""
 create an instance in db More...
 
 $sql_statement_read =""
 read an instance in db More...
 
 $sql_statement_update =""
 update an instance in db More...
 
 $sql_statement_delete =""
 delete an instance in db More...
 
 $sql_statement_each =""
 sql each stand for selecting objects in db More...
 
 $sql_statement_stats =""
 

Detailed Description

This Class is the fundamental class of the framework and holds the final ORM object.

IMPORTANT ! use this class to give your "business class" the ORM functionnalities.

The functions defined at this abstraction level allow any child class to take advantage of :

Author
Gael JAUNIN

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

constructor for xuClass Final object

Member Function Documentation

◆ __call()

__call (   $funcName,
  $arguments 
)

calling an undefined method => seek for the collection having the name of the function => and find search

Parameters
string$funcName
array$arguments
Returns
xsClass::find()

◆ __invoke()

__invoke (   $sql = "")

calling object as a function => launches the find() method

◆ __toString()

__toString ( )

return object html when invoking it as a string

Returns
string

◆ copy()

copy ( )

public create a new instance of the current object in database

Returns
xsClass

◆ create()

create (   $input = "")

create an instance of the current object in database

Parameters
optionnal$inputarray store the key/val to use when creating the new instance
Returns
xsClass

◆ delete()

delete ( )

public kills the current object in database removes its disk space

Returns
xsClass

◆ each()

each (   $pfunc)

SELECTION & XSCLASS applies a function to all XSCLASS objects within _selection array selection array should not be empty :

See also
xsClass::jqset

◆ find()

find (   $criteria = "__NOTHING__")
   COLLECTIONS & PDO
  Remplit le tableau de selection avec des objets PDO en utilisant l'instruction SQL "sql_statement_each"
   ou une instruction SQL en paramètre choisie par l'utilisateur

   la méthode est chainable, l'instruction suivante est généralement "each" si on veut utiliser les object PDO ou si on veut utiliser les objets XSCLASS
   @see xsClass::each()
   ---------------------------------------------------------------------------------------------------------------

USAGE $string=""; $bibliotheque->jqfind("SELECT * FROM table_meslivres WHERE 1=1 ")->each(function($livre) use(&$string){ $string .= $livre->titre; })

echo $string;

◆ read()

read ( )

◆ update()

update (   $input = "",
  $value = "" 
)

Update the instance of xsClass in database if $value is a string, the method updates a single property named $input (must be the name of an existing field in DB) if $input is an array (usually the _POST) => the method prepares xsProperties values and update the database if $input is empty => the method update the database

Parameters
Array$input
String$value
Returns
xsClass

◆ upload()

upload ( )

Save Posted Files

Returns
xsClass

◆ val()

val (   $arr = "_POST")

Set values for xsClass properties using _POST (default) or any associative array USAGE : This method doesn't updates the DB, only the current instance $this->val(); USAGE : if you want to update values in DB, next use update() :

$this->val()->update(); note : if a file is uploaded, it will be saved on DB update

Parameters
Array$arr
Returns
xsClass

Field Documentation

◆ $_selectionType

$_selectionType = "__NOTHING__"

flag that determines which kind of selection is asked (sql, properties ...)

See also
xsClass::find()
xsClass::each()

◆ $collections

$collections =array()

array of xsCollections

See also
xsCollection

◆ $methods

$methods =array()

array of xsMethods (end user public methods)

See also
xsMethod

◆ $properties

$properties =array()

array of xsProperties

See also
xsProperty

◆ $uploading

$uploading =false

boolean that determines if a file is uploaded with the posted _form