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

    In my app I have one controller for handling the stockmovement requests, I made one method to create incomings and another one for outgoings. In the model how can I handle this? Both actions are creating a new record, but I should validate differently. Is it possible to get the request or I need to pass it somehow to the model? or anything else? what is the possibilities in the MVC pattern? please anybody tell me what is the best practice for this situation.

    regards

    Vektor
    • CommentAuthorKaste
     

    ->single table inheritance

    dont understand what youre trying to do, but i'll say something anyway.

    You have a transactions-model. then you have two types of transactions: incomings, outgoings.

    now you can query: get me all in's. get me all transactions. etc.

    • CommentAuthorvektor
     

    Kaste,

    I have 2 models in the stockmove controller:

    var $models = 'stockmove, product';
    

    I have two functions here:

    function outgoing()
    function incoming()
    

    when I want to take to the stock any product I can use any quantity because it is incoming goods. when I want to make an outgoing transaction I must validate the quantity you know it is less or equal with the current quantity I have in the stock. Anyway I must to know in the validation the direction of the transaction, (addition/subtraction) I think not a good solution for this, if I begin to make a lot of models. The only difference is in the validation,

    I hope I can wrote down clearly what is my problem

    • CommentAuthorKaste
     

    sorry, i dont get it.

    validate against quantity must be >= 0 ?

    • CommentAuthorvektor
     

    of course if it's an outgoing. The main difference is the quantity check and the direction of the operation. The quantity in the post is irrelevant if the request was an incoming operation, but in the other case the quantity is important, and I must be check.