Coder Social home page Coder Social logo

Comments (6)

Jurigag avatar Jurigag commented on May 31, 2024 1

Well i really like this idea, we could even for example create like Entity class without any extends or something which would have all necessary methods, and extend it both in our model class and row class, so we could still have all needed methods(though this could be achieved already therotically with magic __call.

from phalcon.

richmilns avatar richmilns commented on May 31, 2024

I've had a go at adding this functionality - it's my first time using Zephir but I was able to test this and it seems to be working as outlined above.

I added get/set methods for the Resultset Row Class.

from phalcon.

richmilns avatar richmilns commented on May 31, 2024

I just saw the announcement about 3.4.2 being the last release for 3.x. My code above was based on the 3.4.x branch of Phalcon, so I guess it might be in the wrong place! Please advise if this needs to be refactored on the 4.0.x branch instead, and if you'd like this submitted as a pull request?

from phalcon.

Jurigag avatar Jurigag commented on May 31, 2024

I think we should consider this more to have better compability with php 7.2 features, what i mean:

interface Xyz
{
    public function getName();
}
class RowXyz extends Phalcon\Mvc\Mode\Row implements Xyz
{
    public $name;

    public function getName()
    {
        return $this->name;
    }
}
class ModelXyz extends Phalcon\Mvc\Model implements Xyz
{
    protected $name;

    public function getName()
    {
        return $this->name;
    }
}

And then somewhere we could have code like:

class XyzRepository
{
    public function findByParams(array $params) : ?Xyz
    {
        // we create somewhere $arrayParams which can have or not columns property
        return ModelXyz::findFirst($arrayParams);
    }
}

Also i would even vote for adding posibility that it doesn't needs to extend Row object, it's already simple object just having some additional methods, maybe just implementing some interface could be enough.

from phalcon.

richmilns avatar richmilns commented on May 31, 2024

I was hoping to re-open this if that's OK with everyone πŸ‘

from phalcon.

niden avatar niden commented on May 31, 2024

It's open. I removed the stale tag (bot)

from phalcon.

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.