yii2-to-prisma

Transforms Yii2 Active Record and Query Builder queries into Prisma Client syntax.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "yii2-to-prisma" with this command: npx skills add egalvez-svg/mis-skills/egalvez-svg-mis-skills-yii2-to-prisma

Yii2 to Prisma Transformation Skill

This skill provides a systematic approach to convert PHP Yii2 database queries into TypeScript/JavaScript Prisma Client queries.

Query Syntax Mapping

1. Basic Operations

Yii2 (PHP)Prisma (TypeScript)Comment
User::find()prisma.user.findMany()Basic multi-row fetch
User::findOne($id)prisma.user.findUnique({ where: { id: $id } })Fetch by ID
User::find()->count()prisma.user.count()Count
User::find()->exists()prisma.user.findFirst({ select: { id: true } }) !== nullExistence check

2. Filters (where)

Yii2Prisma
->where(['id' => 1])where: { id: 1 }
->andWhere(['status' => 1])where: { AND: [ { status: 1 } ] } (or just merge if simple)
->orWhere(['status' => 1])where: { OR: [ { status: 1 } ] }
->where(['>', 'age', 18])where: { age: { gt: 18 } }
->where(['in', 'id', [1, 2]])where: { id: { in: [1, 2] } }
->where(['like', 'name', 'john'])where: { name: { contains: 'john', mode: 'insensitive' } }

3. Relations

Yii2Prisma
->joinWith('profile')include: { profile: true }
->with(['posts', 'comments'])include: { posts: true, comments: true }
->select(['id', 'email'])select: { id: true, email: true }

4. Pagination and Sorting

Yii2Prisma
->orderBy('created_at DESC')orderBy: { created_at: 'desc' }
->limit(10)take: 10
->offset(20)skip: 20

Transformation Rules

  1. CamelCase Conversion: Ensure that field names in Yii2 (often snake_case) are mapped correctly to the Prisma schema (often camelCase).
  2. Boolean Mapping: Yii2 often uses 0 and 1 for booleans. Prisma uses true and false.
  3. Date Handling: Yii2 might use Unix timestamps or SQL dates. Prisma uses JS Date objects.
  4. Nested Relations: Yii2 joinWith can be nested using dot notation (->joinWith('a.b')). Prisma uses nested include.

Examples

Complex Query

Yii2:

$results = Product::find()
    ->select(['id', 'name', 'price'])
    ->joinWith('category')
    ->where(['category.slug' => 'electronics'])
    ->andWhere(['>', 'price', 100])
    ->orderBy('price DESC')
    ->limit(5)
    ->all();

Prisma:

const results = await prisma.product.findMany({
  select: {
    id: true,
    name: true,
    price: true,
    category: true,
  },
  where: {
    category: {
      slug: 'electronics',
    },
    price: {
      gt: 100,
    },
  },
  orderBy: {
    price: 'desc',
  },
  take: 5,
});

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

OpenClaw Mobile Gateway Installer

Installs and manages OpenClaw mobile gateway as a system service. Invoke when users need one-command deploy, start, stop, upgrade, or uninstall.

Registry SourceRecently Updated
Coding

Agent Stack Picker

Recommend a minimal, battle-tested stack for AI-agent-driven product development. Use when choosing technology for web, mobile, desktop, backend, automation,...

Registry SourceRecently Updated
Coding

Github Actions Gen

Unknown: help. Use when you need github actions gen capabilities. Triggers on: github actions gen, type, lang, deploy, matrix, no-cache.

Registry SourceRecently Updated
1080ckchzh
Coding

Fontpick

Font pairing and typography helper for designers and developers. Get selectd font pairings by style (modern, classic, minimal, bold, code), generate CSS font...

Registry SourceRecently Updated