Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Error when relationships are arrays. #5

@kevdowney

Description

@kevdowney

Installed v1.0.0

 codesleeve/fixture                v1.0.0             A framework agnostic, simple (yet elegant) fixture library for php.
 codesleeve/fixture-l4             dev-master 23db25b A simple, easy to use fixture library for Laravel 4

ErrorException: explode() expects parameter 2 to be string, array given

/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Drivers/Eloquent.php:147
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Drivers/Eloquent.php:113
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Drivers/Eloquent.php:71
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Fixture.php:312
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Fixture.php:289
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Fixture.php:252
/api/vendor/codesleeve/fixture/src/Codesleeve/Fixture/Fixture.php:203
/api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:208

fixtures/assets.php

return array(
    'asset_1' => array(
        'account' => 'account_1',
        'url' => 'https://example.com/images/image1.jpg',
        'name' => 'image1.jpg',
        'type' => 'image',
    ),
    'asset_2' => array(
        'account' => 'account_1',
        'url' => 'https://example.com/images/image2.jpg',
        'name' => 'image2.jpg',
        'type' => 'image',
    ),
);

fixtures/products.php

return array(
    'product_2_service' => array(
        'type' => 'service',
        'name' => 'Test Service Product 2',
        'description' => 'Qui aliquid magni laborum et aliquam. Nesciunt ut reiciendis libero architecto aliquid atque maiores. Placeat cum incidunt omnis tempore qui.',
        'sku' => 'TEST_SKU-SERVICE-00002',
       ...
        'assets' => 'asset_1,asset_2'  // OK
       ...
        'assets' => array('asset_1', 'asset_2')  // ERROR
    ),
);

Your documentation says to use arrays for these many relationships, so either we should update the documentation or fix this to support array relationships?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions