Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
OutOfBoundsException [ Error ]: Property "" not found for
  • Hi there, I'm trying to use the ORM to create a relationship between two tables. The database structure is pretty rubbish, and i'm unable to change any tables names etc. This is the error message I get: OutOfBoundsException [ Error ]: Property "" not found for Model_Categories_Description. My two models look like this: <?php
    // category.php
    class Model_Category extends \Orm\Model
    { protected static $_table_name = 'categories'; protected static $_primary_key = array('categories_id'); protected static $_properties = array(
    'categories_id',
    'categories_image',
    'parent_id',
    'sort_order',
    'active',
    'date_added',
    'last_modified'
    ); protected static $_observers = array(
    'Orm\Observer_CreatedAt' => array(
    'events' => array('before_insert'),
    'mysql_timestamp' => false,
    'property' => 'date_added',
    ),
    'Orm\Observer_UpdatedAt' => array(
    'events' => array('before_save'),
    'mysql_timestamp' => false,
    'property' => 'last_modified',
    ),
    ); protected static $_has_one = array('categories_description' => array(
    'model_to' => 'Model_Categories_Description',
    'key_from' => 'categories_id',
    'key_to' => 'categories_id',
    )); } <?php
    // categories/description.php class Model_Categories_Description extends \Orm\Model
    { protected static $_table_name = 'categories_description'; protected static $_primary_key = 'categories_id'; protected static $_properties = array(
    'categories_id',
    'language_id',
    'categories_name',
    'created_at',
    'updated_at'
    ); protected static $_observers = array(
    'Orm\Observer_CreatedAt' => array(
    'events' => array('before_insert'),
    'mysql_timestamp' => false,
    ),
    'Orm\Observer_UpdatedAt' => array(
    'events' => array('before_save'),
    'mysql_timestamp' => false,
    ),
    );
    protected static $_belongs_to = array('category' => array(
    'model_to' => 'Model_Category',
    'key_from' => 'categories_id',
    'key_to' => 'categories_id',
    ));
    } The raw sql that fuel produces works perfectly when manually ran using phpmyadmin, but if I use:
    $categories = Model_Category::find('all', array('related' => array('categories_description')));
    I get that error mentioned above. Any ideas on how I go about fixing this? Thanks, Andy
  • Typically this is caused by the description column not being defined either in the model or in the view and its looking for it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion