Code Monkey home page Code Monkey logo

yii2-collection's People

Contributors

arhell avatar bizley avatar cebe avatar kartavik avatar klimov-paul avatar machour avatar rustamwin avatar samdark avatar softark avatar vanodevium avatar wintersilence avatar

Stargazers

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

Watchers

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

yii2-collection's Issues

update github folder link

What steps will reproduce the problem?

http=>https

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

Idea: Fluent interface

The current implementation of GeneratorCollection supports functions like filter and map.

Doing something like I've proposed here: nikic/iter#45
Would allow for a fluent interface allowing code like

$collection->filter(...)->map(....)->...

PHP Version requirement

Yii 2 requires PHP 5.4, but this requires at least 5.5, I'd suggest, if you are using a stricter requirement than Yii 2 anyway, to just go with 7.0 or 7.1. (Since that is where Yii 2.1 will go as well)

When package will be released?

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

update tests folder links

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

update root folder links

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

Similar interface to work with collection of models as with single model

Right now basic CRUD for model looks like this:

    public function actionCreate()
    {
        $model = new User();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

    public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }

    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

When we need to work with tabular input and handle multiple instances of the same model in single request, things get more complicated (and still there is no docs for it).

ModelCollection could provide wrappers that makes this similar to CRUD for single model:

    public function actionCreate()
    {
        $collection = (new PostCollection())->fill(Post::className(), 10);

        if ($collection->load(Yii::$app->request->post()) && $collection->save()) {
            return $this->redirect(['index']);
        } else {
            return $this->render('create', [
                'collection' => $collection,
            ]);
        }
    }

    public function actionUpdate($ids)
    {
        /* @var $collection PostCollection */
        $collection = $this->findModels($ids);

        if ($collection->load(Yii::$app->request->post()) && $collection->save()) {
            return $this->redirect(['index']);
        } else {
            return $this->render('update', [
                'collection' => $collection,
            ]);
        }
    }

    public function actionDelete($ids)
    {
        $this->findModels($ids)->delete();

        return $this->redirect(['index']);
    }

Related: https://github.com/yiisoft/yii2/issues/14727

update docs folder links

What steps will reproduce the problem?

http=https

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

update irc link

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Collection version
PHP version
Operating system

Project infastructure setup

Basic project infastructure should be setup, allowing early access and contributing.
Following action should be performed:

  • setup 'yiisoft/yii2-collection' project at packagist.org
  • setup GitHub hook for 'packagist.org' package synchronization
  • setup project build on Travis
  • setup GitHub hook for 'Travis' automatic build for main branches and pull requests

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.