Code Monkey home page Code Monkey logo

entities's People

Contributors

hackwar avatar hleithner avatar isacandrei avatar mbabker avatar nibra avatar philetaylor avatar wilsonge avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entities's Issues

Support prepared statements

Now that the database API consistently uses (and requires) prepared statement support, this package should support that as well. To do a lookup by anything that's not a PK still requires manual quoting of all values.

// Current behavior
$data = (new MyModel)->where('name = ' . $db->quote($name))->get();

// Preferred behavior
$data = (new MyModel)->where('name', '=', $name);

// With this method prototype in the Query class
public function where(string $column, $value, string $operator = '=', string $glue = 'AND')
{
    $paramName = ':' . $column;

    $this->query->where($column . ' ' . $operator . ' ' . $paramName, $glue);

    // TODO - Support defining the parameter type too, or at least detecting based on the $value param type?
    $this->query->bind($paramName, $value);

    return $this;
}

Circular dependencies

Deal with the fact that there can be recursion in models if properties depend on each other.

Proposed solution: Add maximum depth to loaded relations in a Model.

setAttribute needs to check the key is known

After we apply the alias we need to check if the key is a valid attribute and throw an exception if it's not

Maybe introduce the property of virtual properties to deal with the fact that there maybe properties we split up (e.g. in the CMS com_content's articletext)

We need a find method in the Model class

To find a data item you need to call

$populatedModel = (new UserModel($this->db))->newQuery()->find($primaryKey);

which involves creating two model instances - which is kinda suboptimal :/

Create release

Composer cannot be set by default, since there is no stable version published

restricting virtual properties

Either by caching setMutators or by whitelisting the virtual properties. Throw an exception if attribute(property) does not exist.

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.