Giter Site home page Giter Site logo

Comments (2)

evan108108 avatar evan108108 commented on July 26, 2024

This is because CActiveRecord allows access to lazy load of relations (which happen @ render), is easily serializable and in general is a more useful reference then a basic array (though $data is often an array of CActiveRecord objects). That said its a really just a design decision that we made along the way. The best part about RESTFullYii is that you can hook these events or create and throw your own thus completely changing the behavior to fit your needs without needing to alter the underlying code.

All that said, I assume you are asking this question for a reason. Let me know why and perhaps we will change it. Additionally I would very much like to encourage you to fork this repo ,make changes and submit pull requests.

from restfullyii.

miteshsc avatar miteshsc commented on July 26, 2024

I have same question, as i want to add some more information while rendering a data but somehow it is not possible..

$onRest(ERestEvent::REQ_GET_RESOURCE_RENDER, function($data, $model_name, $relations, $count, $visibleProperties=[], $hiddenProperties=[]) {
            //Handler for GET (single resource) request
            ;$this->setHttpStatus(200);
            $this->renderJSON([
                'type'              => 'rest',
                'success'           => (($count > 0)? true: false),
                'message'           => (($count > 0)? "Record Found": "No Record Found"),
                'totalCount'    => $count,
                'modelName'     => $model_name,
                'relations'     => $relations,
                'visibleProperties' => $visibleProperties,
                'hiddenProperties' => $hiddenProperties,
                'data'              => $data,
                'extra_info_array' => $extra_info_array
            ]);
        });

@evan108108 @evgeniyVB possible to do this?? because sometimes we need additional information along with CActiveRecord object..

if you have already added this feature then would like to know.

from restfullyii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.