Skip to content

Instantly share code, notes, and snippets.

View roxblnfk's full-sized avatar
🤪

Aleksei Gagarin roxblnfk

🤪
View GitHub Profile
@roxblnfk
roxblnfk / How to use.php
Last active July 16, 2019 23:29
FlySystem/WebDAV wrapper (fix ->readStream() for v1.0.5 https://github.com/thephpleague/flysystem-webdav/tree/1.0.5)
<?php
use League\Flysystem\Filesystem;
use WebDAVAdapterWrapper;
use WebDAVClientWrapper;
$client = new WebDAVClientWrapper($settings);
$adapter = new WebDAVAdapterWrapper($client);
$flysystem = new Filesystem($adapter);
@roxblnfk
roxblnfk / attributes.md
Last active April 8, 2021 05:02
Cycle ORM attributes

Cycle ORM: Атрибуты

Теперь в Cycle ORM для описания схемы наравне с аннотациями можно использовать атрибуты.

Плавность перехода с аннотаций на атрибуты обеспечат:

  1. В аннотациях и атрибутах используются одни и те же классы, с теми же параметрами.
  2. По умолчанию аннотации можно использовать совместно с атрибутами.
  3. Совместимость с PHP >=7.2
    Несмотря на то, что атрибуты нативно поддерживаются только с PHP 8, начинать использовать их можно уже сейчас. \
@roxblnfk
roxblnfk / !index.md
Last active July 14, 2021 15:31
ORM v1 vs v2

Связанная issue: cycle/orm#149 В основе проект yiisoft/demo

Выполняемая команда на добавление фикстур: yii fixture/add 200

  • данные рандомные и относительно рандомного объёма (между двумя запусками могут отличаться на 50%)
  • Сущности: User, Post, Comment, Tag
  • Схема:
    [comment] :: default.comment
       Entity     : App\Blog\Entity\Comment
    
@roxblnfk
roxblnfk / en.md
Last active July 14, 2021 16:16
Cycle ORM 2.0: Proxy Entity & Custom collections

Proxy Entity

Let's look at an example. We have an entity User, which is related to other entities by the relation HasOne and HasMany:

User {
    id: int
    name: string
 profile: ?Profile (HasOne, nullable, lazy load)
@roxblnfk
roxblnfk / !index.md
Last active November 18, 2021 11:27
CYCLE ORM v2 SUMMARY [En]

Cycle ORM V2 (dev)

Gist is dedicated to general changes in Cycle ORM 2.0 in relation to the first version.
It is being developed in the 2.0.x-dev branch and will be updated as updates are made.

Installation:

In the composer.json set the directive minimum-stability: "dev",
then run composer require cycle/orm "2.0.x-dev" (or add by hand).

@roxblnfk
roxblnfk / !index.md
Last active October 21, 2022 23:18
CYCLE ORM v2 SUMMARY [Ru]

Cycle ORM V2 (dev)

Gist посвящён общим изменениям в Cycle ORM 2.0 относительно первой версии.
Разработка ведётся в ветке 2.0.x-dev, по мере поступления обновлений гист будет дополняться.

Установка:

В composer.json установить директиву minimum-stability: "dev",
затем выполнить composer require cycle/orm "2.0.x-dev".
Рекомендуется также установить "prefer-stable": true.

@roxblnfk
roxblnfk / article.md
Last active July 26, 2023 18:21
Cycle ORM до связей жадный

Cycle ORM до связей жадный

Preview

#[Entity]
class Comment {
    #[Column(type="integer", primary: true, typecast="int")]
    public ?int $id = null;
    #[Column(type="integer", name="post_id" typecast="int")]