Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Cycle ORM #23

Merged
merged 14 commits into from
Jan 22, 2020
Merged

Using Cycle ORM #23

merged 14 commits into from
Jan 22, 2020

Conversation

samdark
Copy link
Member

@samdark samdark commented Sep 8, 2019

In this pull request we're using Cycle ORM to store user data.

There's a console command ./vendor/bin/yii user/create to create a user. After user is created you can try logging in with credentials entered.

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Tests pass? ✔️
Fixed issues -

@samdark samdark added the type:feature New feature label Sep 8, 2019
@fcaldarelli
Copy link
Member

Why to use Cycle ORM instead Yii orm ?

@lubosdz
Copy link

lubosdz commented Sep 9, 2019

Same reason as usually - reduce maintenance costs due to insufficient funding of core developers :-(

@demonking
Copy link

demonking commented Sep 9, 2019

Have we a comparison between yii-orm and Cycle ORM?

Usabilty,Performance etc?

@lubosdz
Copy link

lubosdz commented Sep 9, 2019

@demonking
No, not againts Yii2 ORM, only comparison Cycle vs Doctrine (symfony) & Eloquent (laravel):
cycle/docs#3

@fcaldarelli
Copy link
Member

Same reason as usually - reduce maintenance costs due to insufficient funding of core developers :-(

By proceeding in this way, Yii will become a set of external libraries and we will dependent from all of these. If they change something, we mandatory need to change. Bad thing.

@terabytesoftw
Copy link
Member

With yii3 you can use any library including Active Record of Yii2, the point is that you have to migrate it and that will take time, you can contribute helping in the migration.

@demonking
Copy link

demonking commented Sep 9, 2019

But it's not that easy with Yii ORM and Cycle ORM, the usage is different.

You cannot switch them without problems.

Cycle uses Annotation, Yii AR don't (or i haven't seen it).

Also samdark mentioned it in all new issue's with enchantment's

active-record#75

@samdark
Copy link
Member Author

samdark commented Sep 9, 2019

Seems there are questions about our plans:

  1. @terabytesoftw is correct that we aim to make Yii work with any database abstraction layer be it Cycle, Doctrine, plain PDO or anything else.
  2. @lubosdz is correct that maintenance cost of Yii 2 AR was quite high when it was developed actively. We were able to handle it with active participation of @cebe, @SilverFire, @klimov-paul, @dynasource, @arogachev. And, of course, with @qiangxue outstanding effort. So, indeed, we need more active developers to have our own database abstraction layer and it can be achieved in many ways including more funding.
  3. We have no published comparison of Cycle / Yii 2 AR but I helped forming Cycle feature-set and query builder syntax at early stages so it's good enough. You can check the guide.
  4. @FabrizioCaldarelli is correct that it's a good idea to have our own implementation if/when we can do better than the rest of implementations. If not, we introduce interfaces or, in rare cases, use third party libraries directly.
  5. Each ORM syntax is different and, indeed, it's best to choose one at the start of the project and stick to it. But some patterns could help. In this pull request you can see repository in action. Note that no code working with IdentityRepository was changed.

@wolfy-j
Copy link

wolfy-j commented Sep 10, 2019

Is it very easy to make Cycle build without Annotations (they are specifically moved out of core). We would def consider alternative ways of mapping definition if someone can propose Yii-like alternative.

@rustamwin
Copy link
Member

So, indeed, we need more active developers to have our own database abstraction layer and it can be achieved in many ways including more funding.

@samdark

@lubosdz
Copy link

lubosdz commented Sep 10, 2019

@samdark
You are in a difficult position. Would it not be safer to start with Yii3 only once sufficient funding is secured? Until then just maintaining Yii2 & develop solid business model ... OpenColletive may never provide enough funds to cover 4-5 developers. It's been a few months already but only 1 fulltime developer collected so far.

@terabytesoftw
Copy link
Member

terabytesoftw commented Sep 10, 2019

I sincerely believe that this discussion has left the subject, simply Yii 3 will not be equal to Yii 2, and understanding what @samdark says, everything will be migrated, everything will also depend on the help of the community.

@samdark
Copy link
Member Author

samdark commented Sep 10, 2019

Yes, let's not off-topic here. If you have ideas to discuss, let's use forums.

@samdark
Copy link
Member Author

samdark commented Sep 12, 2019

TODO

  • Try MigrationGenerator for pipeline
  • Remove resetschema, syncschema from pipeline
  • Add cycle:migrate console command (see show changes)
  • Change default from plural to singular in table names

@roxblnfk roxblnfk mentioned this pull request Oct 15, 2019
@roxblnfk
Copy link
Member

Change default from plural to singular in table names

This behavior is hard-coded here.

If needed singular in table names then only manually set this in the annotations

@wolfy-j
Copy link

wolfy-j commented Oct 16, 2019

@samdark @roxblnfk check 2.0.2, you can now configure the naming strategy for tables. https://github.com/cycle/annotated/blob/master/src/Entities.php#L31

@roxblnfk
Copy link
Member

roxblnfk commented Oct 16, 2019

@wolfy-j wow, my comment has outdated in just 18 minutes :)

@samdark
Copy link
Member Author

samdark commented Oct 23, 2019

Most code migrated to yiisoft/yii-cycle#1

@samdark samdark closed this Oct 23, 2019
@samdark samdark reopened this Oct 23, 2019
roxblnfk and others added 9 commits October 23, 2019 20:22
* Replaced the variable with the getter method. (#24)

* Remove unused views

* Update meta files

* Tune config

* Allow accessing container instance in globals.php

See yiisoft/di#99

* ContectController fix mailer params (#28)

* Added routes names and replaced static URL to dynamic (#29)

* Use `auth` package (#30)

* Config fix
@samdark samdark merged commit 08bb6ad into master Jan 22, 2020
@samdark samdark deleted the cycle-orm branch January 22, 2020 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants