->getLinks()

->getLinks() -- 関連するオブジェクトをロードする

概要

boolean $DB_DataObject->getLinks ([string $variableFormat])

説明

links.iniの関連情報を使用して、 メインオブジェクトに関連する全てのオブジェクトをロードします。 また、アンダースコア (_) 付きの行名で 呼び出しているオブジェクト変数を結果オブジェクトにセットします。

以前のカラム名変換を使用することは推奨されません。 links.ini ファイルが使用されます。

パラメータ

返り値

boolean - 成功時は TRUE、失敗時は FALSE

注意

この関数は、スタティックにコールする ことはできません。

参照

DB_DataObject::getLink()

例 39-22つの例の表

Person
+---------------+---------------+------+-----+---------+----------------+
| Field         | Type          | Null | Key | Default | Extra          |
+---------------+---------------+------+-----+---------+----------------+
| id            | mediumint(9)  |      | PRI | 0       | auto_increment |
| first_name    | varchar(80)   | YES  |     | NULL    |                |
| last_name     | varchar(80)   |      | MUL |         |                |
| middle_name   | varchar(80)   | YES  |     | NULL    |                |
| badge_number  | smallint(6)   | YES  |     | NULL    |                |
| street        | varchar(80)   | YES  |     | NULL    |                |
| city          | varchar(80)   | YES  |     | NULL    |                |
| state         | varchar(80)   | YES  |     | NULL    |                |
| zip           | varchar(15)   | YES  |     | NULL    |                |
| phone         | varchar(15)   | YES  |     | NULL    |                |
| reg_type      | varchar(80)   | YES  |     | NULL    |                |
| judge         | varchar(10)   | YES  |     | NULL    |                |
| staff         | varchar(10)   | YES  |     | NULL    |                |
| volunteer     | varchar(10)   | YES  |     | NULL    |                |
| rpga_number   | mediumint(9)  | YES  |     | NULL    |                |
| total_fee     | float(10,2)   | YES  |     | NULL    |                |
| email_address | varchar(80)   | YES  |     | NULL    |                |
| country       | varchar(30)   | YES  |     | NULL    |                |
| convention_id | int(11)       |      |     | 0       |                |
| last_modified | timestamp(14) | YES  |     | NULL    |                |
+---------------+---------------+------+-----+---------+----------------+

Convention
+----------------------+---------------+------+-----+---------+----------------+
| Field                | Type          | Null | Key | Default | Extra          |
+----------------------+---------------+------+-----+---------+----------------+
| id                   | int(11)       |      | PRI | 0       | auto_increment |
| name                 | varchar(50)   |      |     |         |                |
| sponsor_organization | varchar(50)   |      |     |         |                |
| rpga_convention_code | varchar(20)   |      |     |         |                |
| web_site_url         | varchar(200)  |      |     |         |                |
| last_modified        | timestamp(14) | YES  |     | NULL    |                |
| room_id              | int(11)       |      |     |         |                |
+----------------------+---------------+------+-----+---------+----------------+

Room
+----------------------+---------------+------+-----+---------+----------------+
| Field                | Type          | Null | Key | Default | Extra          |
+----------------------+---------------+------+-----+---------+----------------+
| room_id              | int(11)       |      | PRI | 0       | auto_increment |
| name                 | varchar(50)   |      |     |         |                |
+----------------------+---------------+------+-----+---------+----------------+

例 39-5結果の出力

Object:dataobjects_person Object
(
    [_DB_DataObject_version] => 1.0
    [__table] => person
    [_database_dsn] =>
    [_database_dsn_md5] => 3974043abbccdd6412fb156a1d10b98377
    [_database] => testing
    [_condition] =>
    [_group_by] =>
    [_order_by] =>
    [_limit] =>
    [_data_select] => *
    [_link_loaded] => 1
    [_lastError] => pear_error Object
        (
            [error_message_prefix] =>
            [mode] => 1
            [level] => 1024
            [code] => -3
            [message] => getLink:Could not find class for row last_modified, table last
            [userinfo] =>
            [callback] =>
        )

    [id] => 1079
    [N] => 1
    [_DB_resultid] => 2
    [first_name] => Tim
    [last_name] => White
    [middle_name] =>
    [badge_number] => 123
    [street] => 334411 N Washington
    [city] => Texas
    [state] => CO
    [zip] => 12345
    [phone] => 343412323232
    [reg_type] => Staff
    [judge] =>
    [staff] => CHECKED
    [volunteer] =>
    [rpga_number] => 1232323
    [total_fee] => 0.00
    [email_address] => tim@example.com
    [country] => USA
    [convention_id] => 1
    [last_modified] => 20020711084539
    [_first_name] =>
    [_last_name] =>
    [_middle_name] =>
    [_badge_number] =>
    [_reg_type] =>
    [_rpga_number] =>
    [_total_fee] =>
    [_email_address] =>
    [_convention_id] => dataobjects_convention Object
        (
            [_DB_DataObject_version] => 1.0
            [__table] => convention
            [_database_dsn] =>
            [_database_dsn_md5] => 3974043abbcc86412fb156a1d10b98377
            [_database] => testing
            [_condition] =>
            [_group_by] =>
            [_order_by] =>
            [_limit] =>
            [_data_select] => *
            [_link_loaded] =>
            [_lastError] =>
            [id] => 1
            [N] => 1
            [_DB_resultid] => 3
            [name] => ABCD XYZ
            [sponsor_organization] => some sponser
            [rpga_convention_code] => ABCD_XYZ
            [web_site_url] => http://example.com
            [last_modified] => 20020703143828
            [room_id] => 1
        )

    [_last_modified] =>
)

** Note,  This error: [message] => getLink:Could not find class for row last_modified, table last

is caused by the original link code using {tablename}_{colname} for guessing links, this automated
linking should be ignored, and not used, as it is depreciated.