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

    I want to encapsulate data in my models and only access it via getters and setters. This is a normal OO pattern, but this seems to conflict with the AkInflector which must be calling the getters for reasons unbeknownst to me.

    I added some stack logging in AkInflector in the underscore function. Here is the results:

    Here one of the getters returns an array (it's a collection). But the inflector is trying to process it.

    word: Array
    function: setAssociationId
    line: 46
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociation.php
    class: AkAssociation
    >>>
    function: initializeAssociated
    line: 82
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociatedActiveRecord.php
    class: AkAssociation
    >>>
    function: loadAssociations
    line: 310
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord.php
    class: AkAssociatedActiveRecord
    >>>
    function: init
    line: 260
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord.php
    class: AkActiveRecord
    >>>
    function: __construct
    line: 138
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociations\AkBelongsTo.php
    class: AkActiveRecord
    >>>
    function: build
    line: 116
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociations\AkBelongsTo.php
    class: AkBelongsTo
    >>>
    function: findAssociated
    line: 137
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociation.php
    class: AkBelongsTo
    >>>
    function: loadAssociated
    line: 160
    file: C:\Projects\akelos\trunk\lib\AkActiveRecord\AkAssociatedActiveRecord.php
    class: AkAssociation
    >>>
    function: load
    line: 92
    file: C:\Projects\Demo\app\controllers\contact_controller.php
    class: AkAssociatedActiveRecord
    >>>
    function: login
    line:
    file:
    class: ContactController
    >>>
    function: call_user_func_array
    line: 1951
    file: C:\Projects\akelos\trunk\lib\AkActionController.php
    class:
    >>>
    function: performActionWithoutFilters
    line: 1958
    file: C:\Projects\akelos\trunk\lib\AkActionController.php
    class: AkActionController
    >>>
    function: performActionWithFilters
    line: 184
    file: C:\Projects\akelos\trunk\lib\AkActionController.php
    class: AkActionController
    >>>
    function: process
    line: 45
    file: C:\Projects\akelos\trunk\lib\AkDispatcher.php
    class: AkActionController
    >>>
    function: dispatch
    line: 35
    file: C:\Projects\Demo\public\index.php
    class: AkDispatcher

    Kind regards,

    John
    • CommentAuthorJCC
     
    Actually,

    I think I've messed up here. It looks like it failed because it can't find a collection, because the name of the database field is not the name of the class.

    I.e. the field: main_contact_id and the table: contacts.

    Please ignore the post. I'm still researching it.

    John