Login +

Documentation

SLS_FrontModel::getParams

Since SillySmart 1.0

Description

Getter returning all class variables representing database entity
public array getParams ( [ mixed $fks ] );

Parameters

  • mixed $fks
    (bool: if true all fks, if false only current Model) - array fks you want to extract params

Return

array $params
associative array with all class variables

Exemples

  •  // if the current model is map on a table named "user"
     var_dump($user->getParams());
     // will produce :
     array(
     "user_id"=> 1,
     "user_email"=> "laurent@sillysmart.org",
     "user_pwd"=> "password"
     )
  •  // if the current model is map on a table name "news" linked with a foreign key on "user" and "category"
     var_dump($news->getParams(true));
     // will produce :
     array(
     "news_id" => 1,
     "news_title" => "title",
     "news_content" => "my news..."
     "user_id" => 1,
     "user_name" => "Bientz",
     "user_firstname" => "Laurent",
     "category_id" => "1",
     "category_name" => "Digital"
     )
  •  // if the current model is map on a table name "news" linked with a foreign key on "user" and "category"
     var_dump($news->getParams(array('user')));
     // will produce :
     array(
     "news_id" => 1,
     "news_title" => "title",
     "news_content" => "my news..."
     "user_id" => 1,
     "user_name" => "Bientz",
     "user_firstname" => "Laurent"
     )

Comments

No comment on this function, be the first !

Add your comment

You must login/register to post a reply.