[-][+] demo@doophp
Doophp Database ORM demo. Class used - DooSqlMagic
...

Food, Food Type and Articles

Result: SQL executed.

SELECT food.*, food_type.*, article.id AS _t_article_id, article.title AS _t_article_title, article.content AS _t_article_content, article.createtime AS _t_article_createtime, article.draft AS _t_article_draft, article.food_id AS _t_article_food_id,  food.id AS _food__id, food_type.id AS _food_type__id, food.name AS _food__name, food_type.name AS _food_type__name,  food_type.id AS _food_type__id
                    FROM food
                     JOIN article ON article.food_id = food.id 
                    LEFT OUTER JOIN food_type
                    ON food.food_type_id = food_type.id
                    WHERE food.name='Nasi Lemak' AND article.draft='0' 
                      

Food Object
(
    [id] => 4
    [name] => Nasi Lemak
    [description] => A kind of rice made with coconut milk
    [location] => Malaysia
    [food_type_id] => 4
    [_table] => food
    [_primarykey] => id
    [_fields] => Array
        (
            [0] => id
            [1] => name
            [2] => description
            [3] => location
            [4] => food_type_id
        )

    [FoodType] => FoodType Object
        (
            [id] => 4
            [name] => Rice
            [_table] => food_type
            [_primarykey] => id
            [_fields] => Array
                (
                    [0] => id
                    [1] => name
                )

            [_t_article_id] => 3
            [_t_article_title] => More on Nasi Lemak
            [_t_article_content] => This is something additional to Nasi Lemak.....
            [_t_article_createtime] => 2009-07-20 21:57:35
            [_t_article_draft] => 0
            [_t_article_food_id] => 4
        )

    [Article] => Array
        (
            [0] => Article Object
                (
                    [id] => 1
                    [title] => Nasi Lemak Review
                    [content] => This is a review for nasi lemak, a common for a Malaysian.
                    [createtime] => 2009-07-15 21:56:40
                    [draft] => 0
                    [food_id] => 4
                    [_table] => article
                    [_primarykey] => id
                    [_fields] => Array
                        (
                            [0] => id
                            [1] => title
                            [2] => content
                            [3] => createtime
                            [4] => draft
                            [5] => food_id
                        )

                )

            [1] => Article Object
                (
                    [id] => 3
                    [title] => More on Nasi Lemak
                    [content] => This is something additional to Nasi Lemak.....
                    [createtime] => 2009-07-20 21:57:35
                    [draft] => 0
                    [food_id] => 4
                    [_table] => article
                    [_primarykey] => id
                    [_fields] => Array
                        (
                            [0] => id
                            [1] => title
                            [2] => content
                            [3] => createtime
                            [4] => draft
                            [5] => food_id
                        )

                )

        )

)

BACK TO LAST PAGE