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

    Dear Akelos Team,

    My sincere thanks to Bermi and Team for giving such a wonderful framework. I am really obsessed by it and could not stop working in it. It really deserves more usage than it is presently has. After all, it reduces coding time to great amount and lets programmer enjoy life !

    I have visited most of the available links in the process of creating my own application. I need some help from you to really finish my application, thereby learn Akelos. I have also tried to solve the problem of another programmer in this forum.

    http://forum.akelos.org/discussion/511/start-problem-ubuntu-linux/#Item_4

    I am able to use the scripts but unable to make changes by hand, due to lack of knowledge. Eventhough, I have a little bit of experience PHP (but not in Ruby / RoR / MVC) I find it difficult to tweak my application. Given below are some important details (remaining fields I have left out for brevity)

    Application: Trucking

    Tables: Agent, Contact

    Agent : id (PK), name, contact_id (FK) // will $have_one contact

    Contact: id(PK), contact_name

    I ran

    ./script/generate model Agent
    ./script/generate model Contact
    

    I observed that

    ./script/generate scaffold Agent Trucking
    

    will leave out contact_id, which if OK. But, I want ..

    1. trucking/view/_form.tpl to have a html select with the list of available contact_name (and store the contact_id) for later use.

    2. trucking/view/show.tpl to show the agent table with the contact.contact_name (instead of agent.contact_id)

    3. trucking/view/list.tpl to show the agent table with the contact.contact_name (instead of agent.contact_id) in the content_columns.

    I could make the agent.contact_id appear only in the form, because of easy code. However in the show and list, i am unable to get it appear.

    I understand that the form_helper is one solution (in the form) and i also checked with the api documentation, but still unable to understand. I think, it is basically because I do not know what entries to make in which model / controller and view files.

    Can you please help me. Thanks in anticipation.

    Note: I will publish my experience with Akelos, hoping to spread it.


    Ubuntu Jaunty Jackalope - Http, MySQL, PHP - Akelos Framework

    •  
      CommentAuthorbermi
     

    Hi pannet1

    I hope you find these code snippets helpful.

    1. trucking/view/_form.tpl to have a html select with the list of available contact_name (and store the contact_id) for later use.
    <?= $form_options_helper->select('Agent', 'contact_id', $Contact->collect($Contact->find(array('order'=>'name')), 'name', 'id')); ?>
    
    1. trucking/view/show.tpl to show the agent table with the contact.contact_name (instead of agent.contact_id)
    2. trucking/view/list.tpl to show the agent table with the contact.contact_name (instead of agent.contact_id) in the content_columns.

    On your finders you should include the associations to be lazy loaded

    !($this->Agent =& $this->Agent->find(@$this->params['id'], array('include'=>'contact')))){
    

    and then just access the attribute in the view

    {Agent.contact.name?}
    

    Cheers

    Bermi

    • CommentAuthorpannet1
     

    dear bermi,

    thank you. i am working on it and will update you the outcome.

    best regards