Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsuthern
     

    This has been bugging me for a while, but I've always found a way around it. (custom SQL select commands via $this->AnotherModel->_db)

    Some time ago we lost the ability to refer to a object if it's name is plural, even from inside it's own controller!

    The object name is "PartsOrders". When I do something like $this->PartsOrders->find('all') it fails with the error

    Fatal error: Call to a member function type() on a non-object
    

    If I print_r($this->PartsOrders), I get only a partial 'model' printout. Here is the printout:

    PartsOrders Object
    (
    [belongs_to] => Array
        (
            [0] => order
            [1] => unit
            [2] => part
            [parts_vendors] => Array
                (
                    [class_name] => PartsVendors
                )
    
        )
    
    [_tableName] => 
    [_db] => 
    [_newRecord] => 
    [_freeze] => 
    [_dataDictionary] => 
    [_primaryKey] => 
    [_inheritanceColumn] => 
    [_associations] => 
    [_internationalize] => 
    [_errors] => Array
        (
        )
    
    [_attributes] => Array
        (
        )
    
    [_protectedAttributes] => Array
        (
        )
    
    [_accessibleAttributes] => Array
        (
        )
    
    [_recordTimestamps] => 1
    [_columnNames] => Array
        (
        )
    
    [_columns] => Array
        (
        )
    
    [_contentColumns] => Array
        (
        )
    
    [_dynamicMethods] => 
    [_combinedAttributes] => Array
        (
        )
    
    [_BlobQueryStack] => 
    [_automated_max_length_validator] => 1
    [_automated_validators_enabled] => 1
    [_automated_not_null_validator] => 
    [_set_default_attribute_values_automatically] => 1
    [_activeRecordHasBeenInstantiated] => 1
    [__ActsLikeAttributes] => Array
        (
        )
    
    [_defaultErrorMessages] => Array
        (
            [inclusion] => is not included in the list
            [exclusion] => is reserved
            [invalid] => is invalid
            [confirmation] => doesn't match confirmation
            [accepted] => must be accepted
            [empty] => can't be empty
            [blank] => can't be blank
            [too_long] => is too long (max is %d characters)
            [too_short] => is too short (min is %d characters)
            [wrong_length] => is the wrong length (should be %d characters)
            [taken] => has already been taken
            [not_a_number] => is not a number
        )
    
    [__activeRecordObject] => 1
    [_observable_state] => 
    [_calculation_options] => Array
        (
            [0] => conditions
            [1] => joins
            [2] => order
            [3] => select
            [4] => group
            [5] => having
            [6] => distinct
            [7] => limit
            [8] => offset
        )
    
    [_AssociationHandler] => 
    [_associationId] => 
    [_associationIds] => Array
        (
        )
    
    [_modelName] => PartsOrders
    )
    

    yes, that's ALL of it! No field names at all, and a bunch of other stuff I haven't taken the time to look into is also missing.

    Has anyone else run across this? I'd kinda like to be able to perform finds on this object again. :-)

    I know it used to work about 2 months ago. Anyone?

    • CommentAuthorsuthern
     

    Ahh, and once again a little bit of digging solves the issue.

    Inside the \app\models\parts_orders.php

    function __constructor()
    {
        $this->setModelName("PartsOrders");
    }
    

    Solves the problem. I'll leave these posts here for someone else to find. :-)