Compare commits

..

10 Commits

Author SHA1 Message Date
Marek Lenczewski
0d028beda8 update task and schema module 2026-04-14 18:15:05 +02:00
Marek Lenczewski
d576747155 update schema module 2026-04-14 00:43:47 +02:00
Marek Lenczewski
4a053c5ee7 update ddev 2026-04-12 21:55:04 +02:00
Marek
3ae593fb97 update app version 2026-04-12 21:24:19 +02:00
Marek
df7f956f2d deloyment update 2026-04-12 21:11:39 +02:00
root
f8f316461c add server changes 2026-04-12 17:42:51 +00:00
Marek Lenczewski
168f6ba6b7 update plan 2026-04-12 16:02:23 +02:00
Marek Lenczewski
3fd7bb661c App update module update 2026-04-12 15:49:56 +02:00
Marek Lenczewski
5198769de4 TaskSchema module 2026-04-12 15:42:48 +02:00
Marek Lenczewski
4e81cea831 App update module 2026-04-12 10:46:14 +02:00
3839 changed files with 3218 additions and 467182 deletions

View File

@@ -27,6 +27,9 @@ web_extra_daemons:
- name: vite
command: "npm run dev"
directory: /var/www/html/frontend
- name: scheduler
command: "php /var/www/html/backend/bin/console messenger:consume scheduler_default --time-limit=3600"
directory: /var/www/html/backend
# Key features of DDEV's config.yaml:

14
.gitignore vendored
View File

@@ -1,10 +1,10 @@
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
backend/.env.local
backend/.env.local.php
backend/.env.*.local
backend/config/secrets/prod/prod.decrypt.private.php
backend/public/bundles/
backend/var/
backend/vendor/
###< symfony/framework-bundle ###

129
CLAUDE.md
View File

@@ -2,13 +2,13 @@
Basis-Software mit 3 geplanten Apps: Task Manager, Shopping List, Meal Planner.
Aktueller Stand: **Task module** implementiert (siehe `module.md`) — Backend + Vue + Kotlin App jeweils end-to-end mit Task-CRUD, Status-Handling und Datum.
Aktueller Stand: **TaskSchema module** implementiert (siehe `module.md`).
## Tech-Stack
| Schicht | Technologie |
|---------|------------|
| Backend | Symfony 7.4, PHP 8.3, Doctrine ORM |
| Backend | Symfony 7.4, PHP 8.3, Doctrine ORM, Symfony Messenger + Scheduler |
| Frontend Web | Vue 3 (Composition API), Vite, Pinia, Vue Router 4 |
| Frontend Mobile | Kotlin + Jetpack Compose (Material 3), Retrofit + kotlinx.serialization |
| Datenbank | MariaDB 10.11 (utf8mb4) |
@@ -20,118 +20,93 @@ Aktueller Stand: **Task module** implementiert (siehe `module.md`) — Backend +
```
backend/
src/
Collection/TaskCollection.php — IteratorAggregate, filterInactive/sortByDueDate*
Controller/Api/TaskController.php — REST-Routen unter /api/tasks
DTO/TaskRequest.php — readonly promoted constructor, Validator + Context(!Y-m-d)
Entity/Task.php — Doctrine entity, getStatus() derived-past
Enum/TaskStatus.php — active, done, inactive, past (past nicht user-selectable)
Repository/TaskRepository.php — currentTasks(), allTasks() → TaskCollection
Service/TaskManager.php — create/update/delete/toggle Business-Logik
Kernel.php
config/ — nelmio_cors, doctrine, framework, ...
migrations/Version20260411141650.php — tasks table
public/index.php
Collection/TaskCollection.php, TaskSchemaCollection.php
Controller/Api/TaskController.php, TaskSchemaController.php
DTO/TaskRequest.php, TaskSchemaRequest.php
Entity/Task.php (+ schema FK), TaskSchema.php
Enum/TaskStatus.php, TaskSchemaStatus.php
Message/GenerateTasksMessage.php
MessageHandler/GenerateTasksMessageHandler.php
Repository/TaskRepository.php, TaskSchemaRepository.php
Service/TaskManager.php (update/delete/toggle), TaskSchemaManager.php (create/update/delete), TaskGenerator.php (generateTasks/removeTasks/generateNewTasks)
Schedule.php — Scheduler (cron 0 3 * * *)
config/packages/messenger.yaml — scheduler_default transport
migrations/
public/app/version.json + haushalt.apk — App-Update
frontend/
src/
components/Icon.vue — zentrales Icon-Component
router/index.js — /, /tasks, /tasks/all, /tasks/create, /tasks/:id mit breadcrumb meta
services/api.js — fetch wrapper, tasks() + statuses() Endpoints
stores/tasks.js — Pinia store: fetchCurrent, fetchAll, get, create, update, remove, toggle, fetchStatuses
views/
Startpage.vue — Nav-Kacheln
Task.vue — /tasks (aktuelle Tasks), Card-pro-Datum mit Legend-Titel
TaskAll.vue — /tasks/all (alle Tasks, flache Liste mit Edit/Delete)
TaskCreate.vue — /tasks/create
TaskEdit.vue — /tasks/:id
App.vue — Breadcrumb-Layout + RouterView
main.js — Vue-Init (Pinia + Router)
components/Icon.vue
router/index.js — /, /tasks, /tasks/all, /tasks/:id, /schemas, /schemas/create, /schemas/:id
services/api.js taskApi + schemaApi
stores/tasks.js, schemas.js
views/ — Startpage, Task, TaskAll, TaskEdit, SchemaCreate, SchemaAll, SchemaEdit
app/app/src/main/java/de/haushalt/app/
MainActivity.kt — Compose entry
MainScreen.kt — NavHost (start, tasks, tasks/all, tasks/create, tasks/{id})
StartScreen.kt — Nav-Kacheln
data/
ApiClient.kt — Retrofit + kotlinx.serialization Setup
TaskApi.kt — Retrofit interface (list, get, create, update, delete, toggle, statuses)
Task.kt — Task + TaskStatus enum
ui/task/
TaskScreen.kt — /tasks, gleiches Card-Gruppierungs-Muster wie Vue
TaskAllScreen.kt — /tasks/all flache Liste, Edit/Delete
TaskCreateScreen.kt / TaskCreateViewModel.kt
TaskEditScreen.kt / TaskEditViewModel.kt
TaskListViewModel.kt — visibleTasks, groupedTasks, showDone, refresh, toggle
TaskAllViewModel.kt
DatePickerField.kt — Material 3 DatePickerDialog Wrapper
StatusDropdown.kt — ExposedDropdownMenuBox, Status-Labels vom Backend
DateFormat.kt — formatDate() mit dd.MM.yyyy
MainActivity.kt, MainScreen.kt, StartScreen.kt
data/ — ApiClient, TaskApi, Task, TaskSchemaApi, TaskSchema, AppUpdateApi, AppUpdater
ui/task/ — TaskScreen, TaskAllScreen, TaskEditScreen, ViewModels, DatePickerField, StatusDropdown, DateFormat
ui/schema/ — SchemaCreateScreen, SchemaEditScreen, SchemaAllScreen, ViewModels, SchemaComponents
```
## Domänenmodell
**Task**
- `id`, `name`, `date` (nullable, ISO), `status`
- Status-Enum (`TaskStatus`): `active`, `done`, `inactive`, `past`
- `past` ist **derived** — wenn `date < today`, liefert `Task::getStatus()` automatisch `past`; der rohe gespeicherte Wert bleibt erhalten (`getRawStatus()`)
- `past` ist **nicht user-selectable** (siehe `TaskStatus::userSelectableValues()`)
- Filter `/api/tasks?filter=current` → Tasks ohne `inactive`, sortiert nach `date` aufsteigend (null-first)
- Default (`/api/tasks`) → alle Tasks, sortiert nach `date` absteigend
**Task**: id, name, date?, status (active/done/inactive/past), schema?
- `past` ist derived (date < today), nicht user-selectable
**TaskSchema**: id, name, status (active/inactive), taskStatus, date?, repeat (json)?, start?, end?
- repeat=null → single (Task direkt, kein Schema persistiert)
- repeat={"daily":true} / {"weekly":[7 bools]} / {"monthly":[31 bools]}
- getRepeatType() → 'daily' | 'weekly' | 'monthly' | null
## REST-API
| Methode | Route | Zweck |
|---|---|---|
| GET | `/api/tasks?filter=current` | aktuelle Tasks (für `/tasks`) |
| GET | `/api/tasks` | alle Tasks (für `/tasks/all`) |
| GET | `/api/tasks/statuses` | user-selectable Statuswerte als `string[]` |
| GET | `/api/tasks?filter=current` | aktuelle Tasks |
| GET | `/api/tasks` | alle Tasks |
| GET | `/api/tasks/statuses` | selectable Statuswerte |
| GET | `/api/tasks/{id}` | einzelner Task |
| POST | `/api/tasks` | Task anlegen |
| PUT | `/api/tasks/{id}` | Task aktualisieren |
| DELETE | `/api/tasks/{id}` | Task löschen |
| PATCH | `/api/tasks/{id}/toggle` | Status zwischen `active`/`done` togglen |
Request-DTO: `TaskRequest` (name, date `!Y-m-d`, status). Deserialisiert + validiert via `#[MapRequestPayload]`.
Response-Serialisierung: Symfony Serializer mit `groups: ['task:read']`, Datum als ISO `Y-m-d` String.
| PATCH | `/api/tasks/{id}/toggle` | activedone togglen |
| GET | `/api/task-schemas` | alle Schemas |
| GET | `/api/task-schemas/{id}` | einzelnes Schema |
| POST | `/api/task-schemas` | Schema erstellen (+ Tasks generieren) |
| PUT | `/api/task-schemas/{id}` | Schema aktualisieren (remove + regenerate Tasks) |
| DELETE | `/api/task-schemas/{id}` | Schema + nicht-past Tasks löschen |
## UI-Muster
- **`/tasks`** (Vue + Kotlin): Tasks nach Datum gruppiert in Cards. Datum sitzt als Pill auf dem Top-Border der Card (fieldset/legend-Look). No-Date-Tasks oben in titelloser Card. `showDone` default `false`.
- **`/tasks/all`** (Vue + Kotlin): Flache Liste mit Edit- und Delete-Icons. `past`-Tasks mit Opacity 0.5, `inactive` kursiv, `done` durchgestrichen.
- **Icon-Reihenfolge `/tasks` Header**: plus, list, eye, refresh.
- Kotlin-Screens refreshen auf `Lifecycle.Event.ON_RESUME` via `DisposableEffect` (gegen stale Daten nach Navigation).
- Status-Labels in Create/Edit kommen aus dem Backend (`/api/tasks/statuses`) — nicht clientseitig hardcoded.
- **`/tasks`**: Tasks nach Datum gruppiert in Cards (Legend-Titel). Icons: calendar, +, list, eye, refresh.
- **`/tasks/all`**: Flache Liste mit Edit/Delete. past=0.5 opacity, inactive=kursiv, done=durchgestrichen.
- **`/schemas`**: Schema-Liste mit Name + Repeat nebeneinander, Edit/Delete Icons.
- **Schema Create/Edit**: name, (status + taskStatus nebeneinander), repeat, weekday/monthday grid, (start + end nebeneinander).
- Kotlin: Lifecycle-Refresh via DisposableEffect ON_RESUME.
- App-Update: "Update prüfen" Button auf StartScreen, APK von Server laden.
## Dokumentation
- **`base.md`** — Vision: was gebaut wird (3 Apps, Systeme, Datenbank-Skizze)
- **`module.md`** — Implementierungs-Schritte als Feature-Module (Backend + Frontend end-to-end pro Modul)
- **`base.md`** — Vision: was gebaut wird
- **`module.md`** — Implementierungs-Schritte als Feature-Module
- **`CLAUDE.md`** (diese Datei) — Ist-Zustand des Codes
## Code-Konventionen
- **Sprache Code**: Englisch (Klassen, Methoden, Variablen)
- **Sprache UI**: Deutsch
- **Enum-Werte**: Englisch in DB und Code
- **Datum im Backend**: ISO `Y-m-d` (als DTO-Input und in Response-JSON)
- **Datum im UI**: `dd.MM.yyyy` — Formatierung in Vue (`formatDate` in `Task.vue`) und Kotlin (`DateFormat.kt`)
- **Sprache Code**: Englisch, **UI**: Deutsch, **Enum-Werte**: Englisch
- **Datum**: Backend ISO `Y-m-d`, UI `dd.MM.yyyy`
- **Frontend**: Vue 3 Composition API mit `<script setup>`
## Development
```bash
# DDEV starten
ddev start
# Backend
ddev exec "cd backend && php bin/console cache:clear"
ddev exec "cd backend && php bin/console doctrine:migrations:migrate"
# Frontend
ddev exec "cd frontend && npm install"
ddev exec "cd frontend && npm run dev -- --host 0.0.0.0"
ddev exec "cd frontend && npm run build"
# Android App (Java 17 für Gradle)
cd app && JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 ./gradlew :app:installDebug
# App-Update: APK nach backend/public/app/ kopieren, version.json versionCode hochzählen
# URLs
Frontend: https://haushalt.ddev.site:5173
API: https://haushalt.ddev.site/api

View File

@@ -13,12 +13,29 @@ android {
applicationId = "de.haushalt.app"
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "0.1.0"
versionCode = 5
versionName = "0.1.1"
}
signingConfigs {
create("release") {
storeFile = file("../haushalt.jks")
storePassword = "haushalt123"
keyAlias = "haushalt"
keyPassword = "haushalt123"
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
}
}
buildTypes {
debug {
buildConfigField("String", "BASE_URL", "\"http://192.168.178.34:8080/\"")
}
release {
signingConfig = signingConfigs.getByName("release")
buildConfigField("String", "BASE_URL", "\"https://haushalt.marha.de/\"")
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
@@ -38,6 +55,7 @@ android {
buildFeatures {
compose = true
buildConfig = true
}
}

View File

@@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:label="@string/app_name"
@@ -16,6 +17,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

View File

@@ -22,8 +22,10 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import de.haushalt.app.ui.schema.SchemaAllScreen
import de.haushalt.app.ui.schema.SchemaCreateScreen
import de.haushalt.app.ui.schema.SchemaEditScreen
import de.haushalt.app.ui.task.TaskAllScreen
import de.haushalt.app.ui.task.TaskCreateScreen
import de.haushalt.app.ui.task.TaskEditScreen
import de.haushalt.app.ui.task.TaskScreen
@@ -35,16 +37,28 @@ private val trailMap: Map<String, List<Pair<String, String>>> = mapOf(
"tasks" to "Tasks",
"tasks/all" to "All",
),
"tasks/create" to listOf(
"start" to "Haushalt",
"tasks" to "Tasks",
"tasks/create" to "Create",
),
"tasks/{id}" to listOf(
"start" to "Haushalt",
"tasks" to "Tasks",
"tasks/{id}" to "Edit",
),
"schemas" to listOf(
"start" to "Haushalt",
"tasks" to "Tasks",
"schemas" to "Schemas",
),
"schemas/create" to listOf(
"start" to "Haushalt",
"tasks" to "Tasks",
"schemas" to "Schemas",
"schemas/create" to "Create",
),
"schemas/{id}" to listOf(
"start" to "Haushalt",
"tasks" to "Tasks",
"schemas" to "Schemas",
"schemas/{id}" to "Edit",
),
)
@Composable
@@ -70,9 +84,6 @@ fun MainScreen() {
composable("tasks/all") {
TaskAllScreen(navController = navController)
}
composable("tasks/create") {
TaskCreateScreen(navController = navController)
}
composable(
route = "tasks/{id}",
arguments = listOf(navArgument("id") { type = NavType.IntType })
@@ -80,6 +91,19 @@ fun MainScreen() {
val id = entry.arguments?.getInt("id") ?: return@composable
TaskEditScreen(navController = navController, taskId = id)
}
composable("schemas") {
SchemaAllScreen(navController = navController)
}
composable("schemas/create") {
SchemaCreateScreen(navController = navController)
}
composable(
route = "schemas/{id}",
arguments = listOf(navArgument("id") { type = NavType.IntType })
) { entry ->
val id = entry.arguments?.getInt("id") ?: return@composable
SchemaEditScreen(navController = navController, schemaId = id)
}
}
}
}

View File

@@ -1,26 +1,54 @@
package de.haushalt.app
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import de.haushalt.app.data.AppUpdater
import de.haushalt.app.data.AppVersion
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
private sealed interface UpdateState {
data object Idle : UpdateState
data object Checking : UpdateState
data object NoUpdate : UpdateState
data class Available(val version: AppVersion) : UpdateState
data object Downloading : UpdateState
data class Error(val message: String) : UpdateState
}
@Composable
fun StartScreen(onOpenTasks: () -> Unit = {}) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var updateState by remember { mutableStateOf<UpdateState>(UpdateState.Idle) }
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {
LazyVerticalGrid(
columns = GridCells.Adaptive(minSize = 160.dp),
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
modifier = Modifier.weight(1f),
) {
item {
Card(
@@ -41,4 +69,55 @@ fun StartScreen(onOpenTasks: () -> Unit = {}) {
}
}
}
Spacer(Modifier.padding(8.dp))
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
when (val state = updateState) {
UpdateState.Idle -> TextButton(onClick = {
scope.launch {
updateState = UpdateState.Checking
try {
val version = withContext(Dispatchers.IO) { AppUpdater.checkUpdate() }
updateState = if (version != null) UpdateState.Available(version)
else UpdateState.NoUpdate
} catch (e: Exception) {
updateState = UpdateState.Error(e.message ?: "Fehler")
}
}
}) { Text("Update prüfen") }
UpdateState.Checking -> Text("Prüfe…", style = MaterialTheme.typography.bodySmall)
UpdateState.NoUpdate -> Text(
"App ist aktuell",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
is UpdateState.Available -> Button(onClick = {
scope.launch {
updateState = UpdateState.Downloading
try {
withContext(Dispatchers.IO) {
AppUpdater.downloadAndInstall(context, state.version)
}
updateState = UpdateState.Idle
} catch (e: Exception) {
updateState = UpdateState.Error(e.message ?: "Fehler")
}
}
}) { Text("Update installieren (v${state.version.versionCode})") }
UpdateState.Downloading -> Text(
"Lade herunter…",
style = MaterialTheme.typography.bodySmall,
)
is UpdateState.Error -> TextButton(onClick = { updateState = UpdateState.Idle }) {
Text(state.message, color = MaterialTheme.colorScheme.error)
}
}
}
}
}

View File

@@ -1,5 +1,6 @@
package de.haushalt.app.data
import de.haushalt.app.BuildConfig
import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
@@ -8,23 +9,33 @@ import retrofit2.Retrofit
import retrofit2.converter.kotlinx.serialization.asConverterFactory
object ApiClient {
private const val BASE_URL = "http://192.168.178.34:8080/api/"
val BASE_URL = BuildConfig.BASE_URL
private val API_URL = "${BASE_URL}api/"
private val json = Json {
ignoreUnknownKeys = true
explicitNulls = false
}
private val okHttp: OkHttpClient = OkHttpClient.Builder()
val okHttp: OkHttpClient = OkHttpClient.Builder()
.addInterceptor(
HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BASIC }
)
.build()
val taskApi: TaskApi = Retrofit.Builder()
private val retrofit: Retrofit = Retrofit.Builder()
.baseUrl(API_URL)
.client(okHttp)
.addConverterFactory(json.asConverterFactory("application/json".toMediaType()))
.build()
val taskApi: TaskApi = retrofit.create(TaskApi::class.java)
val schemaApi: TaskSchemaApi = retrofit.create(TaskSchemaApi::class.java)
val appUpdateApi: AppUpdateApi = Retrofit.Builder()
.baseUrl(BASE_URL)
.client(okHttp)
.addConverterFactory(json.asConverterFactory("application/json".toMediaType()))
.build()
.create(TaskApi::class.java)
.create(AppUpdateApi::class.java)
}

View File

@@ -0,0 +1,15 @@
package de.haushalt.app.data
import kotlinx.serialization.Serializable
import retrofit2.http.GET
interface AppUpdateApi {
@GET("app/version.json")
suspend fun getVersion(): AppVersion
}
@Serializable
data class AppVersion(
val versionCode: Int,
val apkFile: String,
)

View File

@@ -0,0 +1,36 @@
package de.haushalt.app.data
import android.content.Context
import android.content.Intent
import androidx.core.content.FileProvider
import de.haushalt.app.BuildConfig
import okhttp3.Request
import java.io.File
object AppUpdater {
suspend fun checkUpdate(): AppVersion? {
val remote = ApiClient.appUpdateApi.getVersion()
return if (remote.versionCode > BuildConfig.VERSION_CODE) remote else null
}
fun downloadAndInstall(context: Context, version: AppVersion) {
val apkUrl = "${ApiClient.BASE_URL}app/${version.apkFile}"
val apkFile = File(context.cacheDir, "apk/haushalt.apk")
apkFile.parentFile?.mkdirs()
val request = Request.Builder().url(apkUrl).build()
ApiClient.okHttp.newCall(request).execute().use { response ->
apkFile.outputStream().use { out ->
response.body!!.byteStream().copyTo(out)
}
}
val uri = FileProvider.getUriForFile(context, "${context.packageName}.fileprovider", apkFile)
val intent = Intent(Intent.ACTION_VIEW).apply {
setDataAndType(uri, "application/vnd.android.package-archive")
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
}
}

View File

@@ -16,9 +16,6 @@ interface TaskApi {
@GET("tasks/{id}")
suspend fun get(@Path("id") id: Int): Task
@POST("tasks")
suspend fun create(@Body body: TaskRequest): Task
@PUT("tasks/{id}")
suspend fun update(@Path("id") id: Int, @Body body: TaskRequest): Task

View File

@@ -0,0 +1,32 @@
package de.haushalt.app.data
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject
@Serializable
enum class TaskSchemaStatus {
active, inactive,
}
@Serializable
data class TaskSchema(
val id: Int? = null,
val name: String,
val status: TaskSchemaStatus = TaskSchemaStatus.active,
val taskStatus: TaskStatus = TaskStatus.active,
val date: String? = null,
val repeat: JsonObject? = null,
val start: String? = null,
val end: String? = null,
)
@Serializable
data class TaskSchemaRequest(
val name: String,
val status: TaskSchemaStatus = TaskSchemaStatus.active,
val taskStatus: TaskStatus = TaskStatus.active,
val date: String? = null,
val repeat: JsonObject? = null,
val start: String? = null,
val end: String? = null,
)

View File

@@ -0,0 +1,26 @@
package de.haushalt.app.data
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.PUT
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
interface TaskSchemaApi {
@GET("task-schemas")
suspend fun list(): List<TaskSchema>
@GET("task-schemas/{id}")
suspend fun get(@Path("id") id: Int): TaskSchema
@POST("task-schemas")
suspend fun create(@Body body: TaskSchemaRequest)
@PUT("task-schemas/{id}")
suspend fun update(@Path("id") id: Int, @Body body: TaskSchemaRequest): TaskSchema
@DELETE("task-schemas/{id}")
suspend fun delete(@Path("id") id: Int)
}

View File

@@ -0,0 +1,137 @@
package de.haushalt.app.ui.schema
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import de.haushalt.app.data.TaskSchema
import de.haushalt.app.data.TaskSchemaStatus
@Composable
fun SchemaAllScreen(
navController: NavController,
viewModel: SchemaAllViewModel = viewModel(),
) {
val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(lifecycleOwner) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
viewModel.refresh()
}
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
) {
IconButton(onClick = { navController.navigate("schemas/create") }) {
Icon(Icons.Filled.Add, contentDescription = "Neues Schema")
}
IconButton(onClick = { viewModel.refresh() }) {
Icon(Icons.Filled.Refresh, contentDescription = "Neu laden")
}
}
Spacer(Modifier.padding(4.dp))
when {
viewModel.isLoading && viewModel.schemas.isEmpty() -> Text("Lädt…")
viewModel.error != null -> Text(viewModel.error ?: "", color = MaterialTheme.colorScheme.error)
viewModel.schemas.isEmpty() -> Text("Keine Schemas.")
else -> LazyColumn(modifier = Modifier.fillMaxSize()) {
items(viewModel.schemas, key = { it.id ?: 0 }) { schema ->
SchemaRow(
schema = schema,
onEdit = { schema.id?.let { navController.navigate("schemas/$it") } },
onDelete = { schema.id?.let(viewModel::delete) },
)
HorizontalDivider()
}
}
}
}
}
@Composable
private fun SchemaRow(
schema: TaskSchema,
onEdit: () -> Unit,
onDelete: () -> Unit,
) {
val repeatLabel = when {
schema.repeat == null -> "Einmalig"
schema.repeat.containsKey("daily") -> "Täglich"
schema.repeat.containsKey("weekly") -> "Wöchentlich"
schema.repeat.containsKey("2week") -> "2-Wöchentlich"
schema.repeat.containsKey("4week") -> "4-Wöchentlich"
schema.repeat.containsKey("monthly") -> "Monatlich"
schema.repeat.containsKey("days") -> "Mehrere Tage"
else -> ""
}
Row(
modifier = Modifier
.fillMaxWidth()
.alpha(if (schema.status == TaskSchemaStatus.inactive) 0.5f else 1f)
.padding(vertical = 8.dp, horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
modifier = Modifier.weight(1f),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = schema.name,
style = MaterialTheme.typography.bodyLarge,
fontStyle = if (schema.status == TaskSchemaStatus.inactive) FontStyle.Italic else null,
)
Text(
text = repeatLabel,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
IconButton(onClick = onEdit) {
Icon(Icons.Filled.Edit, contentDescription = "Bearbeiten")
}
IconButton(onClick = onDelete) {
Icon(Icons.Filled.Delete, contentDescription = "Löschen")
}
}
}

View File

@@ -0,0 +1,48 @@
package de.haushalt.app.ui.schema
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import de.haushalt.app.data.ApiClient
import de.haushalt.app.data.TaskSchema
import kotlinx.coroutines.launch
class SchemaAllViewModel : ViewModel() {
var schemas by mutableStateOf<List<TaskSchema>>(emptyList())
private set
var isLoading by mutableStateOf(false)
private set
var error by mutableStateOf<String?>(null)
private set
init {
refresh()
}
fun refresh() {
viewModelScope.launch {
isLoading = true
error = null
try {
schemas = ApiClient.schemaApi.list()
} catch (e: Exception) {
error = e.message
} finally {
isLoading = false
}
}
}
fun delete(id: Int) {
viewModelScope.launch {
try {
ApiClient.schemaApi.delete(id)
schemas = schemas.filter { it.id != id }
} catch (e: Exception) {
error = e.message
}
}
}
}

View File

@@ -0,0 +1,211 @@
package de.haushalt.app.ui.schema
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import de.haushalt.app.data.TaskSchemaStatus
import de.haushalt.app.data.TaskStatus
import de.haushalt.app.ui.task.DatePickerField
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SchemaStatusDropdown(
current: TaskSchemaStatus,
onChange: (TaskSchemaStatus) -> Unit,
modifier: Modifier = Modifier,
) {
var expanded by remember { mutableStateOf(false) }
ExposedDropdownMenuBox(expanded = expanded, onExpandedChange = { expanded = it }, modifier = modifier) {
OutlinedTextField(
value = current.name,
onValueChange = {},
readOnly = true,
label = { Text("Schema Status") },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded) },
modifier = Modifier.fillMaxWidth().menuAnchor(MenuAnchorType.PrimaryNotEditable),
)
ExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
TaskSchemaStatus.entries.forEach { status ->
DropdownMenuItem(
text = { Text(status.name) },
onClick = { onChange(status); expanded = false },
)
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TaskStatusDropdown(
current: TaskStatus,
onChange: (TaskStatus) -> Unit,
modifier: Modifier = Modifier,
) {
var expanded by remember { mutableStateOf(false) }
val selectable = TaskStatus.entries.filter { it != TaskStatus.past }
ExposedDropdownMenuBox(expanded = expanded, onExpandedChange = { expanded = it }, modifier = modifier) {
OutlinedTextField(
value = current.name,
onValueChange = {},
readOnly = true,
label = { Text("Task Status") },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded) },
modifier = Modifier.fillMaxWidth().menuAnchor(MenuAnchorType.PrimaryNotEditable),
)
ExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
selectable.forEach { status ->
DropdownMenuItem(
text = { Text(status.name) },
onClick = { onChange(status); expanded = false },
)
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RepeatTypeDropdown(
current: String,
onChange: (String) -> Unit,
) {
val options = listOf("none" to "Keine (Einmalig)", "daily" to "Täglich", "weekly" to "Wöchentlich", "2week" to "2-Wöchentlich", "4week" to "4-Wöchentlich", "monthly" to "Monatlich", "days" to "Mehrere Tage")
var expanded by remember { mutableStateOf(false) }
ExposedDropdownMenuBox(expanded = expanded, onExpandedChange = { expanded = it }) {
OutlinedTextField(
value = options.firstOrNull { it.first == current }?.second ?: "",
onValueChange = {},
readOnly = true,
label = { Text("Wiederholung") },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded) },
modifier = Modifier.fillMaxWidth().menuAnchor(MenuAnchorType.PrimaryNotEditable),
)
ExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
options.forEach { (key, label) ->
DropdownMenuItem(
text = { Text(label) },
onClick = { onChange(key); expanded = false },
)
}
}
}
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
fun WeekdaySelector(
selected: List<Boolean>,
onChange: (List<Boolean>) -> Unit,
) {
val days = listOf("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So")
Text("Wochentage", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
days.forEachIndexed { i, day ->
val isSelected = selected[i]
Surface(
modifier = Modifier.clickable {
onChange(selected.toMutableList().also { it[i] = !it[i] })
},
shape = RoundedCornerShape(6.dp),
border = BorderStroke(1.dp, if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline),
color = if (isSelected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface,
) {
Text(
text = day,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),
style = MaterialTheme.typography.bodyMedium,
)
}
}
}
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
fun MonthdaySelector(
selected: List<Boolean>,
onChange: (List<Boolean>) -> Unit,
) {
Text("Monatstage", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
FlowRow(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
for (d in 1..31) {
val isSelected = selected[d - 1]
Surface(
modifier = Modifier.size(40.dp).clickable {
onChange(selected.toMutableList().also { it[d - 1] = !it[d - 1] })
},
shape = RoundedCornerShape(6.dp),
border = BorderStroke(1.dp, if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline),
color = if (isSelected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface,
) {
Text(
text = "$d",
modifier = Modifier.padding(4.dp),
style = MaterialTheme.typography.bodySmall,
)
}
}
}
}
@Composable
fun DaysSelector(
days: List<String>,
onChange: (List<String>) -> Unit,
) {
Text("Termine", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
days.forEachIndexed { i, day ->
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
DatePickerField(
value = day,
onChange = { newVal -> onChange(days.toMutableList().also { it[i] = newVal }) },
label = "Datum",
modifier = Modifier.weight(1f),
)
IconButton(onClick = { onChange(days.toMutableList().also { it.removeAt(i) }) }) {
Icon(Icons.Filled.Delete, contentDescription = "Entfernen")
}
}
}
OutlinedButton(onClick = { onChange(days + "") }) {
Icon(Icons.Filled.Add, contentDescription = null)
Text("Termin")
}
}

View File

@@ -0,0 +1,131 @@
package de.haushalt.app.ui.schema
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import de.haushalt.app.data.TaskSchemaStatus
import de.haushalt.app.data.TaskStatus
import de.haushalt.app.ui.task.DatePickerField
@Composable
fun SchemaCreateScreen(
navController: NavController,
viewModel: SchemaCreateViewModel = viewModel(),
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
OutlinedTextField(
value = viewModel.name,
onValueChange = { viewModel.name = it },
label = { Text("Name") },
modifier = Modifier.fillMaxWidth(),
singleLine = true,
)
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
SchemaStatusDropdown(
current = viewModel.status,
onChange = { viewModel.status = it },
modifier = Modifier.weight(1f),
)
TaskStatusDropdown(
current = viewModel.taskStatus,
onChange = { viewModel.taskStatus = it },
modifier = Modifier.weight(1f),
)
}
RepeatTypeDropdown(
current = viewModel.repeatType,
onChange = { viewModel.repeatType = it },
)
if (viewModel.repeatType == "none") {
DatePickerField(
value = viewModel.date,
onChange = { viewModel.date = it },
label = "Datum",
)
}
if (viewModel.repeatType in listOf("weekly", "2week", "4week")) {
WeekdaySelector(
selected = viewModel.weekly,
onChange = { viewModel.weekly = it },
)
}
if (viewModel.repeatType == "days") {
DaysSelector(
days = viewModel.days,
onChange = { viewModel.days = it },
)
}
if (viewModel.repeatType == "monthly") {
MonthdaySelector(
selected = viewModel.monthly,
onChange = { viewModel.monthly = it },
)
}
if (viewModel.repeatType !in listOf("none", "days")) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
DatePickerField(
value = viewModel.start,
onChange = { viewModel.start = it },
label = "Start",
modifier = Modifier.weight(1f),
)
DatePickerField(
value = viewModel.end,
onChange = { viewModel.end = it },
label = "Ende",
modifier = Modifier.weight(1f),
)
}
}
viewModel.error?.let {
Text(it, color = MaterialTheme.colorScheme.error)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(
enabled = !viewModel.isSubmitting && viewModel.name.isNotBlank(),
onClick = { viewModel.save { navController.popBackStack() } },
) {
Text("Erstellen")
}
OutlinedButton(onClick = { navController.popBackStack() }) {
Text("Abbrechen")
}
}
}
}

View File

@@ -0,0 +1,69 @@
package de.haushalt.app.ui.schema
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import de.haushalt.app.data.ApiClient
import de.haushalt.app.data.TaskSchemaRequest
import de.haushalt.app.data.TaskSchemaStatus
import de.haushalt.app.data.TaskStatus
import kotlinx.coroutines.launch
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.buildJsonArray
class SchemaCreateViewModel : ViewModel() {
var name by mutableStateOf("")
var status by mutableStateOf(TaskSchemaStatus.active)
var taskStatus by mutableStateOf(TaskStatus.active)
var repeatType by mutableStateOf("none")
var date by mutableStateOf("")
var start by mutableStateOf("")
var end by mutableStateOf("")
var weekly by mutableStateOf(List(7) { false })
var monthly by mutableStateOf(List(31) { false })
var days by mutableStateOf(listOf<String>())
var isSubmitting by mutableStateOf(false)
private set
var error by mutableStateOf<String?>(null)
private set
fun save(onSuccess: () -> Unit) {
viewModelScope.launch {
isSubmitting = true
error = null
try {
ApiClient.schemaApi.create(buildRequest())
onSuccess()
} catch (e: Exception) {
error = e.message
} finally {
isSubmitting = false
}
}
}
private fun buildRequest(): TaskSchemaRequest {
val repeat = when (repeatType) {
"daily" -> JsonObject(mapOf("daily" to JsonPrimitive(true)))
"weekly" -> JsonObject(mapOf("weekly" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"2week" -> JsonObject(mapOf("2week" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"4week" -> JsonObject(mapOf("4week" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"monthly" -> JsonObject(mapOf("monthly" to buildJsonArray { monthly.forEach { add(JsonPrimitive(it)) } }))
"days" -> JsonObject(mapOf("days" to buildJsonArray { days.filter { it.isNotBlank() }.forEach { add(JsonPrimitive(it)) } }))
else -> null
}
return TaskSchemaRequest(
name = name,
status = status,
taskStatus = taskStatus,
date = if (repeatType == "none" && date.isNotBlank()) date else null,
repeat = repeat,
start = if (repeatType != "none" && start.isNotBlank()) start else null,
end = if (repeatType != "none" && end.isNotBlank()) end else null,
)
}
}

View File

@@ -0,0 +1,140 @@
package de.haushalt.app.ui.schema
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import de.haushalt.app.ui.task.DatePickerField
@Composable
fun SchemaEditScreen(
navController: NavController,
schemaId: Int,
viewModel: SchemaEditViewModel = viewModel(),
) {
LaunchedEffect(schemaId) {
viewModel.load(schemaId)
}
if (viewModel.isLoading) {
Text("Lädt…", modifier = Modifier.padding(16.dp))
return
}
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
OutlinedTextField(
value = viewModel.name,
onValueChange = { viewModel.name = it },
label = { Text("Name") },
modifier = Modifier.fillMaxWidth(),
singleLine = true,
)
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
SchemaStatusDropdown(
current = viewModel.status,
onChange = { viewModel.status = it },
modifier = Modifier.weight(1f),
)
TaskStatusDropdown(
current = viewModel.taskStatus,
onChange = { viewModel.taskStatus = it },
modifier = Modifier.weight(1f),
)
}
RepeatTypeDropdown(
current = viewModel.repeatType,
onChange = { viewModel.repeatType = it },
)
if (viewModel.repeatType == "none") {
DatePickerField(
value = viewModel.date,
onChange = { viewModel.date = it },
label = "Datum",
)
}
if (viewModel.repeatType in listOf("weekly", "2week", "4week")) {
WeekdaySelector(
selected = viewModel.weekly,
onChange = { viewModel.weekly = it },
)
}
if (viewModel.repeatType == "days") {
DaysSelector(
days = viewModel.days,
onChange = { viewModel.days = it },
)
}
if (viewModel.repeatType == "monthly") {
MonthdaySelector(
selected = viewModel.monthly,
onChange = { viewModel.monthly = it },
)
}
if (viewModel.repeatType !in listOf("none", "days")) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
DatePickerField(
value = viewModel.start,
onChange = { viewModel.start = it },
label = "Start",
modifier = Modifier.weight(1f),
)
DatePickerField(
value = viewModel.end,
onChange = { viewModel.end = it },
label = "Ende",
modifier = Modifier.weight(1f),
)
}
}
viewModel.error?.let {
Text(it, color = MaterialTheme.colorScheme.error)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(
enabled = !viewModel.isSubmitting && viewModel.name.isNotBlank(),
onClick = { viewModel.update(schemaId) { navController.popBackStack() } },
) {
Text("Aktualisieren")
}
OutlinedButton(onClick = { navController.popBackStack() }) {
Text("Abbrechen")
}
}
}
}

View File

@@ -0,0 +1,145 @@
package de.haushalt.app.ui.schema
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import de.haushalt.app.data.ApiClient
import de.haushalt.app.data.TaskSchema
import de.haushalt.app.data.TaskSchemaRequest
import de.haushalt.app.data.TaskSchemaStatus
import de.haushalt.app.data.TaskStatus
import kotlinx.coroutines.launch
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.boolean
import kotlinx.serialization.json.buildJsonArray
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.jsonPrimitive
class SchemaEditViewModel : ViewModel() {
var name by mutableStateOf("")
var status by mutableStateOf(TaskSchemaStatus.active)
var taskStatus by mutableStateOf(TaskStatus.active)
var repeatType by mutableStateOf("none")
var date by mutableStateOf("")
var start by mutableStateOf("")
var end by mutableStateOf("")
var weekly by mutableStateOf(List(7) { false })
var monthly by mutableStateOf(List(31) { false })
var days by mutableStateOf(listOf<String>())
var isLoading by mutableStateOf(false)
private set
var isSubmitting by mutableStateOf(false)
private set
var error by mutableStateOf<String?>(null)
private set
fun load(id: Int) {
viewModelScope.launch {
isLoading = true
error = null
try {
val schema = ApiClient.schemaApi.get(id)
applySchema(schema)
} catch (e: Exception) {
error = e.message
} finally {
isLoading = false
}
}
}
fun update(id: Int, onSuccess: () -> Unit) {
viewModelScope.launch {
isSubmitting = true
error = null
try {
ApiClient.schemaApi.update(id, buildRequest())
onSuccess()
} catch (e: Exception) {
error = e.message
} finally {
isSubmitting = false
}
}
}
private fun applySchema(schema: TaskSchema) {
name = schema.name
status = schema.status
taskStatus = schema.taskStatus
date = schema.date?.take(10) ?: ""
start = schema.start?.take(10) ?: ""
end = schema.end?.take(10) ?: ""
when {
schema.repeat == null -> {
repeatType = "none"
weekly = List(7) { false }
monthly = List(31) { false }
days = listOf()
}
schema.repeat.containsKey("daily") -> {
repeatType = "daily"
weekly = List(7) { false }
monthly = List(31) { false }
days = listOf()
}
schema.repeat.containsKey("weekly") -> {
repeatType = "weekly"
weekly = schema.repeat["weekly"]!!.jsonArray.map { it.jsonPrimitive.boolean }
monthly = List(31) { false }
days = listOf()
}
schema.repeat.containsKey("2week") -> {
repeatType = "2week"
weekly = schema.repeat["2week"]!!.jsonArray.map { it.jsonPrimitive.boolean }
monthly = List(31) { false }
days = listOf()
}
schema.repeat.containsKey("4week") -> {
repeatType = "4week"
weekly = schema.repeat["4week"]!!.jsonArray.map { it.jsonPrimitive.boolean }
monthly = List(31) { false }
days = listOf()
}
schema.repeat.containsKey("monthly") -> {
repeatType = "monthly"
weekly = List(7) { false }
monthly = schema.repeat["monthly"]!!.jsonArray.map { it.jsonPrimitive.boolean }
days = listOf()
}
schema.repeat.containsKey("days") -> {
repeatType = "days"
weekly = List(7) { false }
monthly = List(31) { false }
days = schema.repeat["days"]!!.jsonArray.map { it.jsonPrimitive.contentOrNull ?: "" }
}
}
}
private fun buildRequest(): TaskSchemaRequest {
val repeat = when (repeatType) {
"daily" -> JsonObject(mapOf("daily" to JsonPrimitive(true)))
"weekly" -> JsonObject(mapOf("weekly" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"2week" -> JsonObject(mapOf("2week" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"4week" -> JsonObject(mapOf("4week" to buildJsonArray { weekly.forEach { add(JsonPrimitive(it)) } }))
"monthly" -> JsonObject(mapOf("monthly" to buildJsonArray { monthly.forEach { add(JsonPrimitive(it)) } }))
"days" -> JsonObject(mapOf("days" to buildJsonArray { days.filter { it.isNotBlank() }.forEach { add(JsonPrimitive(it)) } }))
else -> null
}
return TaskSchemaRequest(
name = name,
status = status,
taskStatus = taskStatus,
date = if (repeatType == "none" && date.isNotBlank()) date else null,
repeat = repeat,
start = if (repeatType != "none" && start.isNotBlank()) start else null,
end = if (repeatType != "none" && end.isNotBlank()) end else null,
)
}
}

View File

@@ -12,6 +12,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Refresh
@@ -65,8 +66,11 @@ fun TaskAllScreen(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
) {
IconButton(onClick = { navController.navigate("tasks/create") }) {
Icon(Icons.Filled.Add, contentDescription = "Neuer Task")
IconButton(onClick = { navController.navigate("schemas") }) {
Icon(Icons.Filled.DateRange, contentDescription = "Schemas")
}
IconButton(onClick = { navController.navigate("schemas/create") }) {
Icon(Icons.Filled.Add, contentDescription = "Neues Schema")
}
IconButton(onClick = { viewModel.refresh() }) {
Icon(Icons.Filled.Refresh, contentDescription = "Neu laden")

View File

@@ -1,66 +0,0 @@
package de.haushalt.app.ui.task
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
@Composable
fun TaskCreateScreen(
navController: NavController,
viewModel: TaskCreateViewModel = viewModel(),
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
OutlinedTextField(
value = viewModel.name,
onValueChange = { viewModel.name = it },
label = { Text("Name") },
modifier = Modifier.fillMaxWidth(),
singleLine = true,
)
DatePickerField(
value = viewModel.date,
onChange = { viewModel.date = it },
)
StatusDropdown(
current = viewModel.status,
selectable = viewModel.availableStatuses,
onChange = { viewModel.status = it },
)
viewModel.error?.let {
Text(it, color = MaterialTheme.colorScheme.error)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(
enabled = !viewModel.isSubmitting && viewModel.name.isNotBlank(),
onClick = { viewModel.save { navController.popBackStack() } },
) {
Text("Speichern")
}
OutlinedButton(onClick = { navController.popBackStack() }) {
Text("Abbrechen")
}
}
}
}

View File

@@ -1,54 +0,0 @@
package de.haushalt.app.ui.task
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import de.haushalt.app.data.ApiClient
import de.haushalt.app.data.TaskRequest
import de.haushalt.app.data.TaskStatus
import kotlinx.coroutines.launch
class TaskCreateViewModel : ViewModel() {
var name by mutableStateOf("")
var date by mutableStateOf("")
var status by mutableStateOf(TaskStatus.active)
var availableStatuses by mutableStateOf<List<TaskStatus>>(emptyList())
private set
var isSubmitting by mutableStateOf(false)
private set
var error by mutableStateOf<String?>(null)
private set
init {
viewModelScope.launch {
try {
availableStatuses = ApiClient.taskApi.statuses()
} catch (e: Exception) {
availableStatuses = emptyList()
}
}
}
fun save(onSuccess: () -> Unit) {
viewModelScope.launch {
isSubmitting = true
error = null
try {
ApiClient.taskApi.create(
TaskRequest(
name = name,
date = date.ifBlank { null },
status = status,
)
)
onSuccess()
} catch (e: Exception) {
error = e.message
} finally {
isSubmitting = false
}
}
}
}

View File

@@ -69,9 +69,6 @@ fun TaskEditScreen(
) {
Text("Aktualisieren")
}
OutlinedButton(onClick = { viewModel.reset() }) {
Text("Zurücksetzen")
}
OutlinedButton(onClick = { navController.popBackStack() }) {
Text("Abbrechen")
}

View File

@@ -12,8 +12,6 @@ import de.haushalt.app.data.TaskStatus
import kotlinx.coroutines.launch
class TaskEditViewModel : ViewModel() {
private var original: Task? = null
var name by mutableStateOf("")
var date by mutableStateOf("")
var status by mutableStateOf(TaskStatus.active)
@@ -42,7 +40,6 @@ class TaskEditViewModel : ViewModel() {
error = null
try {
val task = ApiClient.taskApi.get(id)
original = task
applyTask(task)
} catch (e: Exception) {
error = e.message
@@ -74,10 +71,6 @@ class TaskEditViewModel : ViewModel() {
}
}
fun reset() {
original?.let { applyTask(it) }
}
private fun applyTask(task: Task) {
name = task.name
date = task.date?.take(10) ?: ""

View File

@@ -17,6 +17,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
@@ -66,8 +67,11 @@ fun TaskScreen(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.End,
) {
IconButton(onClick = { navController.navigate("tasks/create") }) {
Icon(Icons.Filled.Add, contentDescription = "Neuer Task")
IconButton(onClick = { navController.navigate("schemas") }) {
Icon(Icons.Filled.DateRange, contentDescription = "Schemas")
}
IconButton(onClick = { navController.navigate("schemas/create") }) {
Icon(Icons.Filled.Add, contentDescription = "Neues Schema")
}
IconButton(onClick = { navController.navigate("tasks/all") }) {
Icon(Icons.AutoMirrored.Filled.List, contentDescription = "Alle Tasks")

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="apk" path="apk/" />
</paths>

BIN
app/haushalt.jks Executable file

Binary file not shown.

View File

@@ -38,3 +38,10 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1|haushalt\.ddev\.site)(:[0-9
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

View File

@@ -1,19 +0,0 @@
MAILER_HOST="127.0.0.1"
MAILER_URL="smtp://127.0.0.1:1025"
MAILER_WEB_URL="https://haushalt.ddev.site:8026"
DATABASE_HOST="db"
DATABASE_USER="db"
MAILER_AUTH_MODE=""
MAILER_PORT="1025"
DATABASE_NAME="db"
DATABASE_URL="mysql://db:db@db:3306/db?sslmode=disable&charset=utf8mb4&serverVersion=10.11.0-mariadb"
DATABASE_VERSION="10.11.0-mariadb"
MAILER_CATCHER="1"
DATABASE_DRIVER="mysql"
MAILER_USERNAME=""
DATABASE_PASSWORD="db"
DATABASE_PORT="3306"
DATABASE_SERVER="mysql://db:3306"
MAILER_PASSWORD=""
MAILER_DRIVER="smtp"
MAILER_DSN="smtp://127.0.0.1:1025"

View File

@@ -19,9 +19,11 @@
"symfony/dotenv": "7.4.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.4.*",
"symfony/messenger": "7.4.*",
"symfony/property-access": "7.4.*",
"symfony/property-info": "7.4.*",
"symfony/runtime": "7.4.*",
"symfony/scheduler": "7.4.*",
"symfony/serializer": "7.4.*",
"symfony/validator": "7.4.*",
"symfony/yaml": "7.4.*"

307
backend/composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "36cb2b820400a518223222a28461ff75",
"content-hash": "3faf0714de84c701cf5b3c444ce28e8b",
"packages": [
{
"name": "doctrine/collections",
@@ -1456,6 +1456,54 @@
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
@@ -1789,6 +1837,84 @@
],
"time": "2025-03-13T15:25:07+00:00"
},
{
"name": "symfony/clock",
"version": "v7.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/clock.git",
"reference": "674fa3b98e21531dd040e613479f5f6fa8f32111"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/clock/zipball/674fa3b98e21531dd040e613479f5f6fa8f32111",
"reference": "674fa3b98e21531dd040e613479f5f6fa8f32111",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/clock": "^1.0",
"symfony/polyfill-php83": "^1.28"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"type": "library",
"autoload": {
"files": [
"Resources/now.php"
],
"psr-4": {
"Symfony\\Component\\Clock\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Decouples applications from the system clock",
"homepage": "https://symfony.com",
"keywords": [
"clock",
"psr20",
"time"
],
"support": {
"source": "https://github.com/symfony/clock/tree/v7.4.8"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-03-24T13:12:05+00:00"
},
{
"name": "symfony/config",
"version": "v7.4.7",
@@ -3121,6 +3247,100 @@
],
"time": "2026-03-06T16:33:18+00:00"
},
{
"name": "symfony/messenger",
"version": "v7.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/messenger.git",
"reference": "ddf5ab29bc0329ece30e16f01c86abb6241e92d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/messenger/zipball/ddf5ab29bc0329ece30e16f01c86abb6241e92d8",
"reference": "ddf5ab29bc0329ece30e16f01c86abb6241e92d8",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/log": "^1|^2|^3",
"symfony/clock": "^6.4|^7.0|^8.0",
"symfony/deprecation-contracts": "^2.5|^3"
},
"conflict": {
"symfony/console": "<7.2",
"symfony/event-dispatcher": "<6.4",
"symfony/event-dispatcher-contracts": "<2.5",
"symfony/framework-bundle": "<6.4",
"symfony/http-kernel": "<7.3",
"symfony/lock": "<7.4",
"symfony/serializer": "<6.4.32|>=7.3,<7.3.10|>=7.4,<7.4.4|>=8.0,<8.0.4"
},
"require-dev": {
"psr/cache": "^1.0|^2.0|^3.0",
"symfony/console": "^7.2|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/event-dispatcher": "^6.4|^7.0|^8.0",
"symfony/http-kernel": "^7.3|^8.0",
"symfony/lock": "^7.4|^8.0",
"symfony/process": "^6.4|^7.0|^8.0",
"symfony/property-access": "^6.4|^7.0|^8.0",
"symfony/rate-limiter": "^6.4|^7.0|^8.0",
"symfony/routing": "^6.4|^7.0|^8.0",
"symfony/serializer": "^6.4.32|~7.3.10|^7.4.4|^8.0.4",
"symfony/service-contracts": "^2.5|^3",
"symfony/stopwatch": "^6.4|^7.0|^8.0",
"symfony/validator": "^6.4|^7.0|^8.0",
"symfony/var-dumper": "^6.4|^7.0|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Messenger\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Samuel Roze",
"email": "samuel.roze@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Helps applications send and receive messages to/from other applications or via message queues",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/messenger/tree/v7.4.8"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-03-30T12:55:43+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
"version": "v1.33.0",
@@ -3952,6 +4172,91 @@
],
"time": "2025-12-05T14:04:53+00:00"
},
{
"name": "symfony/scheduler",
"version": "v7.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/scheduler.git",
"reference": "f95e696edaad466db9b087a6480ef936c766c3de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/scheduler/zipball/f95e696edaad466db9b087a6480ef936c766c3de",
"reference": "f95e696edaad466db9b087a6480ef936c766c3de",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/clock": "^6.4|^7.0|^8.0"
},
"require-dev": {
"dragonmantank/cron-expression": "^3.1",
"symfony/cache": "^6.4|^7.0|^8.0",
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0",
"symfony/event-dispatcher": "^6.4|^7.0|^8.0",
"symfony/lock": "^6.4|^7.0|^8.0",
"symfony/messenger": "^6.4|^7.0|^8.0",
"symfony/serializer": "^6.4|^7.1|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Scheduler\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sergey Rabochiy",
"email": "upyx.00@gmail.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides scheduling through Symfony Messenger",
"homepage": "https://symfony.com",
"keywords": [
"cron",
"schedule",
"scheduler"
],
"support": {
"source": "https://github.com/symfony/scheduler/tree/v7.4.8"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-03-24T13:12:05+00:00"
},
{
"name": "symfony/serializer",
"version": "v7.4.7",

View File

@@ -0,0 +1,4 @@
framework:
messenger:
transports:
sync: 'sync://'

View File

@@ -426,7 +426,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* resources?: array<string, scalar|Param|null>,
* },
* messenger?: bool|array{ // Messenger configuration
* enabled?: bool|Param, // Default: false
* enabled?: bool|Param, // Default: true
* routing?: array<string, string|array{ // Default: []
* senders?: list<scalar|Param|null>,
* }>,
@@ -468,7 +468,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* }>,
* },
* scheduler?: bool|array{ // Scheduler configuration
* enabled?: bool|Param, // Default: false
* enabled?: bool|Param, // Default: true
* },
* disallow_search_engine_index?: bool|Param, // Enabled by default when debug is enabled. // Default: true
* http_client?: bool|array{ // HTTP Client configuration

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260412094958 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE task_schema (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, task_status VARCHAR(255) NOT NULL, date DATE DEFAULT NULL, `repeat` JSON DEFAULT NULL, start DATE DEFAULT NULL, end DATE DEFAULT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE task ADD schema_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB25EA1BEF35 FOREIGN KEY (schema_id) REFERENCES task_schema (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_527EDB25EA1BEF35 ON task (schema_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE task_schema');
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB25EA1BEF35');
$this->addSql('DROP INDEX IDX_527EDB25EA1BEF35 ON task');
$this->addSql('ALTER TABLE task DROP schema_id');
}
}

Binary file not shown.

View File

@@ -0,0 +1,4 @@
{
"versionCode": 5,
"apkFile": "haushalt.apk"
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Collection;
use App\Entity\TaskSchema;
/**
* @implements \IteratorAggregate<int, TaskSchema>
*/
final class TaskSchemaCollection implements \IteratorAggregate
{
/** @var list<TaskSchema> */
private array $schemas = [];
/**
* @param list<TaskSchema> $schemas
*/
public function __construct(array $schemas = [])
{
foreach ($schemas as $schema) {
$this->schemas[] = $schema;
}
}
public function getIterator(): \Iterator
{
return new \ArrayIterator($this->schemas);
}
}

View File

@@ -45,14 +45,6 @@ class TaskController extends AbstractController
return $this->json($task, 200, [], ['groups' => ['task:read']]);
}
#[Route('', methods: ['POST'])]
public function create(#[Payload] TaskRequest $dto): JsonResponse
{
$task = $this->manager->create($dto);
return $this->json($task, 201, [], ['groups' => ['task:read']]);
}
#[Route('/{id}', methods: ['PUT'], requirements: ['id' => '\d+'])]
public function update(Task $task, #[Payload] TaskRequest $dto): JsonResponse
{

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Controller\Api;
use App\DTO\TaskSchemaRequest;
use App\Entity\TaskSchema;
use App\Repository\TaskSchemaRepository;
use App\Service\TaskSchemaManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload as Payload;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/api/task-schemas')]
class TaskSchemaController extends AbstractController
{
public function __construct(
private readonly TaskSchemaRepository $repo,
private readonly TaskSchemaManager $manager,
) {
}
#[Route('', methods: ['GET'])]
public function index(): JsonResponse
{
$schemas = $this->repo->allSchemas();
return $this->json($schemas, 200, [], ['groups' => ['task_schema:read']]);
}
#[Route('/{id}', methods: ['GET'], requirements: ['id' => '\d+'])]
public function show(TaskSchema $schema): JsonResponse
{
return $this->json($schema, 200, [], ['groups' => ['task_schema:read']]);
}
#[Route('', methods: ['POST'])]
public function create(#[Payload] TaskSchemaRequest $dto): JsonResponse
{
$this->manager->create($dto);
return new JsonResponse(null, 201);
}
#[Route('/{id}', methods: ['PUT'], requirements: ['id' => '\d+'])]
public function update(TaskSchema $schema, #[Payload] TaskSchemaRequest $dto): JsonResponse
{
$this->manager->update($schema, $dto);
return $this->json($schema, 200, [], ['groups' => ['task_schema:read']]);
}
#[Route('/{id}', methods: ['DELETE'], requirements: ['id' => '\d+'])]
public function delete(TaskSchema $schema): JsonResponse
{
$this->manager->delete($schema);
return new JsonResponse(null, 204);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\DTO;
use App\Enum\TaskSchemaStatus;
use App\Enum\TaskStatus;
use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Validator\Constraints as Assert;
class TaskSchemaRequest
{
public function __construct(
#[Assert\NotBlank]
#[Assert\Length(max: 255)]
public readonly string $name,
#[Assert\NotNull]
public readonly TaskSchemaStatus $status = TaskSchemaStatus::Active,
#[Assert\NotNull]
public readonly TaskStatus $taskStatus = TaskStatus::Active,
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
public readonly ?\DateTimeImmutable $date = null,
public ?array $repeat = null,
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
public readonly ?\DateTimeImmutable $start = null,
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
public readonly ?\DateTimeImmutable $end = null,
) {
if (isset($this->repeat['days']) && is_array($this->repeat['days'])) {
$this->repeat['days'] = array_values(array_unique($this->repeat['days']));
}
}
}

View File

@@ -6,6 +6,7 @@ use App\Enum\TaskStatus;
use App\Repository\TaskRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Attribute\Ignore;
#[ORM\Entity(repositoryClass: TaskRepository::class)]
class Task
@@ -27,6 +28,11 @@ class Task
#[ORM\Column(enumType: TaskStatus::class)]
private TaskStatus $status = TaskStatus::Active;
#[ORM\ManyToOne(targetEntity: TaskSchema::class, inversedBy: 'tasks')]
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
#[Ignore]
private ?TaskSchema $schema = null;
public function getId(): ?int
{
return $this->id;
@@ -77,4 +83,16 @@ class Task
return $this;
}
public function getSchema(): ?TaskSchema
{
return $this->schema;
}
public function setSchema(?TaskSchema $schema): self
{
$this->schema = $schema;
return $this;
}
}

View File

@@ -0,0 +1,158 @@
<?php
namespace App\Entity;
use App\Enum\TaskSchemaStatus;
use App\Enum\TaskStatus;
use App\Repository\TaskSchemaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity(repositoryClass: TaskSchemaRepository::class)]
class TaskSchema
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['task_schema:read'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(['task_schema:read'])]
private string $name = '';
#[ORM\Column(enumType: TaskSchemaStatus::class)]
#[Groups(['task_schema:read'])]
private TaskSchemaStatus $status = TaskSchemaStatus::Active;
#[ORM\Column(enumType: TaskStatus::class)]
#[Groups(['task_schema:read'])]
private TaskStatus $taskStatus = TaskStatus::Active;
#[ORM\Column(type: 'date_immutable', nullable: true)]
#[Groups(['task_schema:read'])]
private ?\DateTimeImmutable $date = null;
#[ORM\Column(name: '`repeat`', type: 'json', nullable: true)]
#[Groups(['task_schema:read'])]
private ?array $repeat = null;
#[ORM\Column(name: '`start`', type: 'date_immutable', nullable: true)]
#[Groups(['task_schema:read'])]
private ?\DateTimeImmutable $start = null;
#[ORM\Column(name: '`end`', type: 'date_immutable', nullable: true)]
#[Groups(['task_schema:read'])]
private ?\DateTimeImmutable $end = null;
/** @var Collection<int, Task> */
#[ORM\OneToMany(targetEntity: Task::class, mappedBy: 'schema')]
private Collection $tasks;
public function __construct()
{
$this->tasks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getStatus(): TaskSchemaStatus
{
return $this->status;
}
public function setStatus(TaskSchemaStatus $status): self
{
$this->status = $status;
return $this;
}
public function getTaskStatus(): TaskStatus
{
return $this->taskStatus;
}
public function setTaskStatus(TaskStatus $taskStatus): self
{
$this->taskStatus = $taskStatus;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(?\DateTimeImmutable $date): self
{
$this->date = $date;
return $this;
}
public function getRepeat(): ?array
{
return $this->repeat;
}
public function getRepeatType(): ?string
{
return $this->repeat !== null ? array_key_first($this->repeat) : null;
}
public function setRepeat(?array $repeat): self
{
$this->repeat = $repeat;
return $this;
}
public function getStart(): ?\DateTimeImmutable
{
return $this->start;
}
public function setStart(?\DateTimeImmutable $start): self
{
$this->start = $start;
return $this;
}
public function getEnd(): ?\DateTimeImmutable
{
return $this->end;
}
public function setEnd(?\DateTimeImmutable $end): self
{
$this->end = $end;
return $this;
}
/** @return Collection<int, Task> */
public function getTasks(): Collection
{
return $this->tasks;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Enum;
enum TaskSchemaStatus: string
{
case Active = 'active';
case Inactive = 'inactive';
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Helper;
class DateHelper
{
public static function isInRange(\DateTimeImmutable $date): bool
{
$today = new \DateTimeImmutable('today');
return $date >= $today && $date <= $today->modify('+14 days');
}
/** @return array{\DateTimeImmutable, \DateTimeImmutable} */
public static function getDateRange(?\DateTimeImmutable $start, ?\DateTimeImmutable $end): array
{
$today = new \DateTimeImmutable('today');
$from = max($today, $start ?? $today);
$to = min($today->modify('+14 days'), $end ?? $today->modify('+14 days'));
return [$from, $to];
}
public static function getWeeksDiff(\DateTimeImmutable $start, \DateTimeImmutable $date): int
{
return (int) ($start->modify('monday this week')->diff($date->modify('monday this week'))->days / 7);
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace App\Message;
final class GenerateTasksMessage
{
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\MessageHandler;
use App\Message\GenerateTasksMessage;
use App\Service\TaskGenerator;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
#[AsMessageHandler]
final class GenerateTasksMessageHandler
{
public function __construct(private TaskGenerator $generator)
{
}
public function __invoke(GenerateTasksMessage $message): void
{
$this->generator->generateNewTasks();
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Repository;
use App\Collection\TaskSchemaCollection;
use App\Entity\TaskSchema;
use App\Enum\TaskSchemaStatus;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<TaskSchema>
*/
class TaskSchemaRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, TaskSchema::class);
}
public function allSchemas(): TaskSchemaCollection
{
return new TaskSchemaCollection(parent::findAll());
}
/** @return list<TaskSchema> */
public function findActive(): array
{
return $this->createQueryBuilder('s')
->andWhere('s.status = :status')
->setParameter('status', TaskSchemaStatus::Active)
->getQuery()
->getResult();
}
/** @return list<TaskSchema> */
public function findExpired(): array
{
return $this->createQueryBuilder('s')
->andWhere('s.end IS NOT NULL')
->andWhere('s.end < :today')
->setParameter('today', new \DateTimeImmutable('today'))
->getQuery()
->getResult();
}
}

27
backend/src/Schedule.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace App;
use App\Message\GenerateTasksMessage;
use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule as SymfonySchedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Contracts\Cache\CacheInterface;
#[AsSchedule]
class Schedule implements ScheduleProviderInterface
{
public function __construct(
private CacheInterface $cache,
) {
}
public function getSchedule(): SymfonySchedule
{
return (new SymfonySchedule())
->stateful($this->cache)
->processOnlyLastMissedRun(true)
->add(RecurringMessage::every('1 day', new GenerateTasksMessage(), from: new \DateTimeImmutable('03:00')));
}
}

View File

@@ -0,0 +1,126 @@
<?php
namespace App\Service;
use App\Entity\Task;
use App\Entity\TaskSchema;
use App\Enum\TaskStatus;
use App\Helper\DateHelper;
use App\Repository\TaskSchemaRepository;
use Doctrine\ORM\EntityManagerInterface;
class TaskGenerator
{
public function __construct(
private EntityManagerInterface $em,
private TaskSchemaRepository $schemaRepo,
) {
}
public function generateNewTasks(): void
{
$this->deleteExpiredSchemas();
$today = new \DateTimeImmutable('today');
$schemas = $this->schemaRepo->findActive();
foreach ($schemas as $schema) {
if ($schema->getRepeatType() === null) {
$date = $schema->getDate();
if ($date !== null && $date->format('Y-m-d') === $today->format('Y-m-d')) {
$this->createTask($schema, $today);
}
} elseif ($this->matchesDate($schema, $today)) {
$this->createTask($schema, $today);
}
}
$this->em->flush();
}
public function removeTasks(TaskSchema $schema): void
{
foreach ($schema->getTasks() as $task) {
if ($task->getStatus() === TaskStatus::Past) continue;
$this->em->remove($task);
}
}
public function generateTasks(TaskSchema $schema): void
{
$dates = $this->getDates($schema);
foreach ($dates as $date) {
$this->createTask($schema, $date);
}
}
private function createTask(TaskSchema $schema, \DateTimeImmutable $date): void
{
$task = new Task();
$task->setName($schema->getName());
$task->setDate($date);
$task->setStatus($schema->getTaskStatus());
$task->setSchema($schema);
$this->em->persist($task);
}
private function deleteExpiredSchemas(): void
{
$expired = $this->schemaRepo->findExpired();
foreach ($expired as $schema) {
$this->removeTasks($schema);
$this->em->remove($schema);
}
}
/** @return list<\DateTimeImmutable> */
private function getDates(TaskSchema $schema): array
{
if ($schema->getRepeatType() === null) {
$date = $schema->getDate();
return DateHelper::isInRange($date) ? [$date] : [];
}
[$from, $end] = DateHelper::getDateRange($schema->getStart(), $schema->getEnd());
$dates = [];
for ($date = $from; $date <= $end; $date = $date->modify('+1 day')) {
if ($this->matchesDate($schema, $date)) {
$dates[] = $date;
}
}
return $dates;
}
private function matchesDate(TaskSchema $schema, \DateTimeImmutable $date): bool
{
$type = $schema->getRepeatType();
$repeat = $schema->getRepeat();
if ($type === 'daily') {
return true;
}
if ($type === 'weekly' || $type === '2week' || $type === '4week') {
$weekday = (int) $date->format('N') - 1;
if (!$repeat[$type][$weekday]) return false;
if ($type === 'weekly') return true;
$start = $schema->getStart() ?? new \DateTimeImmutable('today');
return DateHelper::getWeeksDiff($start, $date) % ($type === '2week' ? 2 : 4) === 0;
}
if ($type === 'monthly') {
$monthday = (int) $date->format('j') - 1;
return $repeat['monthly'][$monthday];
}
if ($type === 'days') {
return in_array($date->format('Y-m-d'), $repeat['days'], true);
}
return false;
}
}

View File

@@ -13,19 +13,6 @@ class TaskManager
{
}
public function create(TaskRequest $req): Task
{
$task = new Task();
$task->setName($req->name);
$task->setDate($req->date);
$task->setStatus($req->status);
$this->em->persist($task);
$this->em->flush();
return $task;
}
public function update(Task $task, TaskRequest $req): Task
{
$task->setName($req->name);

View File

@@ -0,0 +1,78 @@
<?php
namespace App\Service;
use App\DTO\TaskSchemaRequest;
use App\Entity\Task;
use App\Entity\TaskSchema;
use App\Enum\TaskSchemaStatus;
use Doctrine\ORM\EntityManagerInterface;
class TaskSchemaManager
{
public function __construct(
private EntityManagerInterface $em,
private TaskGenerator $generator,
) {
}
public function create(TaskSchemaRequest $req): void
{
if ($req->repeat === null && $req->date === null) {
$task = new Task();
$task->setName($req->name);
$task->setStatus($req->taskStatus);
$this->em->persist($task);
$this->em->flush();
return;
}
$schema = new TaskSchema();
$schema->setName($req->name);
$schema->setStatus($req->status);
$schema->setTaskStatus($req->taskStatus);
$schema->setDate($req->date);
$schema->setRepeat($req->repeat);
$schema->setStart($req->start);
$schema->setEnd($req->end);
$this->em->persist($schema);
$this->em->flush();
if ($schema->getStatus() === TaskSchemaStatus::Inactive) {
return;
}
$this->generator->generateTasks($schema);
$this->em->flush();
}
public function update(TaskSchema $schema, TaskSchemaRequest $req): void
{
$schema->setName($req->name);
$schema->setStatus($req->status);
$schema->setTaskStatus($req->taskStatus);
$schema->setDate($req->date);
$schema->setRepeat($req->repeat);
$schema->setStart($req->start);
$schema->setEnd($req->end);
if ($schema->getStatus() === TaskSchemaStatus::Inactive) {
$this->em->flush();
return;
}
$this->generator->removeTasks($schema);
$this->generator->generateTasks($schema);
$this->em->flush();
}
public function delete(TaskSchema $schema): void
{
$this->generator->removeTasks($schema);
$this->em->remove($schema);
$this->em->flush();
}
}

View File

@@ -101,6 +101,18 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/messenger": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.0",
"ref": "d8936e2e2230637ef97e5eecc0eea074eecae58b"
},
"files": [
"config/packages/messenger.yaml"
]
},
"symfony/property-info": {
"version": "7.4",
"recipe": {
@@ -126,6 +138,18 @@
"config/routes.yaml"
]
},
"symfony/scheduler": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.2",
"ref": "caea3c928ee9e1b21288fd76aef36f16ea355515"
},
"files": [
"src/Schedule.php"
]
},
"symfony/validator": {
"version": "7.4",
"recipe": {

View File

@@ -1,22 +0,0 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
throw new RuntimeException($err);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit75e7f8d848176580e9902a32f6f14640::getLoader();

View File

@@ -1,33 +0,0 @@
<?php
// autoload_runtime.php @generated by Symfony Runtime
if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
return;
}
$app = require $_SERVER['SCRIPT_FILENAME'];
if (!is_object($app)) {
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
}
if (is_string($_SERVER['APP_RUNTIME_OPTIONS'] ??= $_ENV['APP_RUNTIME_OPTIONS'] ?? [])) {
$_SERVER['APP_RUNTIME_OPTIONS'] = json_decode($_SERVER['APP_RUNTIME_OPTIONS'], true, 512, JSON_THROW_ON_ERROR);
}
$_SERVER['APP_RUNTIME'] ??= $_ENV['APP_RUNTIME'] ?? 'Symfony\\Component\\Runtime\\SymfonyRuntime';
$runtime = new $_SERVER['APP_RUNTIME']($_SERVER['APP_RUNTIME_OPTIONS'] += [
'project_dir' => dirname(__DIR__, 1),
]);
[$app, $args] = $runtime
->getResolver($app)
->resolve();
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../doctrine/migrations/bin/doctrine-migrations)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/doctrine/migrations/bin/doctrine-migrations');
}
}
return include __DIR__ . '/..'.'/doctrine/migrations/bin/doctrine-migrations';

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../symfony/error-handler/Resources/bin/patch-type-declarations)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/error-handler/Resources/bin/patch-type-declarations');
}
}
return include __DIR__ . '/..'.'/symfony/error-handler/Resources/bin/patch-type-declarations';

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../doctrine/sql-formatter/bin/sql-formatter)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/doctrine/sql-formatter/bin/sql-formatter');
}
}
return include __DIR__ . '/..'.'/doctrine/sql-formatter/bin/sql-formatter';

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../symfony/var-dumper/Resources/bin/var-dump-server)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server');
}
}
return include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server';

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../symfony/yaml/Resources/bin/yaml-lint)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint');
}
}
return include __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint';

View File

@@ -1,579 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

View File

@@ -1,396 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
* @internal
*/
private static $selfDir = null;
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool
*/
private static $installedIsLocalDir;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}
/**
* @return string
*/
private static function getSelfDir()
{
if (self::$selfDir === null) {
self::$selfDir = strtr(__DIR__, '\\', '/');
}
return self::$selfDir;
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
$selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
return $installed;
}
}

View File

@@ -1,21 +0,0 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,26 +0,0 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'DateError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateError.php',
'DateException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateException.php',
'DateInvalidOperationException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php',
'DateInvalidTimeZoneException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php',
'DateMalformedIntervalStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php',
'DateMalformedPeriodStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php',
'DateMalformedStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php',
'DateObjectError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php',
'DateRangeError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php',
'Deprecated' => $vendorDir . '/symfony/polyfill-php84/Resources/stubs/Deprecated.php',
'NoDiscard' => $vendorDir . '/symfony/polyfill-php85/Resources/stubs/NoDiscard.php',
'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
'Override' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/Override.php',
'ReflectionConstant' => $vendorDir . '/symfony/polyfill-php84/Resources/stubs/ReflectionConstant.php',
'SQLite3Exception' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
'©' => $vendorDir . '/symfony/cache/Traits/ValueWrapper.php',
);

View File

@@ -1,18 +0,0 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'606a39d89246991a373564698c2d8383' => $vendorDir . '/symfony/polyfill-php85/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'9d2b9fc6db0f153a0a149fefb182415e' => $vendorDir . '/symfony/polyfill-php84/bootstrap.php',
'662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php',
);

View File

@@ -1,9 +0,0 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -1,72 +0,0 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-common/src'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'Symfony\\Runtime\\Symfony\\Component\\' => array($vendorDir . '/symfony/runtime/Internal'),
'Symfony\\Polyfill\\Php85\\' => array($vendorDir . '/symfony/polyfill-php85'),
'Symfony\\Polyfill\\Php84\\' => array($vendorDir . '/symfony/polyfill-php84'),
'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
'Symfony\\Flex\\' => array($vendorDir . '/symfony/flex/src'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
'Symfony\\Contracts\\Cache\\' => array($vendorDir . '/symfony/cache-contracts'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'),
'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'),
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
'Symfony\\Component\\TypeInfo\\' => array($vendorDir . '/symfony/type-info'),
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Runtime\\' => array($vendorDir . '/symfony/runtime'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\PropertyInfo\\' => array($vendorDir . '/symfony/property-info'),
'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\ErrorHandler\\' => array($vendorDir . '/symfony/error-handler'),
'Symfony\\Component\\Dotenv\\' => array($vendorDir . '/symfony/dotenv'),
'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'),
'Symfony\\Bundle\\MakerBundle\\' => array($vendorDir . '/symfony/maker-bundle/src'),
'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'),
'Symfony\\Bridge\\Doctrine\\' => array($vendorDir . '/symfony/doctrine-bridge'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
'Nelmio\\CorsBundle\\' => array($vendorDir . '/nelmio/cors-bundle'),
'Doctrine\\SqlFormatter\\' => array($vendorDir . '/doctrine/sql-formatter/src'),
'Doctrine\\Persistence\\' => array($vendorDir . '/doctrine/persistence/src/Persistence'),
'Doctrine\\ORM\\' => array($vendorDir . '/doctrine/orm/src'),
'Doctrine\\Migrations\\' => array($vendorDir . '/doctrine/migrations/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/src'),
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/src'),
'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/src'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/src'),
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/src'),
'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/src'),
'Doctrine\\Bundle\\MigrationsBundle\\' => array($vendorDir . '/doctrine/doctrine-migrations-bundle/src'),
'Doctrine\\Bundle\\DoctrineBundle\\' => array($vendorDir . '/doctrine/doctrine-bundle/src'),
'App\\Tests\\' => array($baseDir . '/tests'),
'App\\' => array($baseDir . '/src'),
);

View File

@@ -1,50 +0,0 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit75e7f8d848176580e9902a32f6f14640
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit75e7f8d848176580e9902a32f6f14640', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit75e7f8d848176580e9902a32f6f14640', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit75e7f8d848176580e9902a32f6f14640::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit75e7f8d848176580e9902a32f6f14640::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}

View File

@@ -1,394 +0,0 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit75e7f8d848176580e9902a32f6f14640
{
public static $files = array (
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'606a39d89246991a373564698c2d8383' => __DIR__ . '/..' . '/symfony/polyfill-php85/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'9d2b9fc6db0f153a0a149fefb182415e' => __DIR__ . '/..' . '/symfony/polyfill-php84/bootstrap.php',
'662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'p' =>
array (
'phpDocumentor\\Reflection\\' => 25,
),
'W' =>
array (
'Webmozart\\Assert\\' => 17,
),
'S' =>
array (
'Symfony\\Runtime\\Symfony\\Component\\' => 34,
'Symfony\\Polyfill\\Php85\\' => 23,
'Symfony\\Polyfill\\Php84\\' => 23,
'Symfony\\Polyfill\\Php83\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
'Symfony\\Flex\\' => 13,
'Symfony\\Contracts\\Translation\\' => 30,
'Symfony\\Contracts\\Service\\' => 26,
'Symfony\\Contracts\\EventDispatcher\\' => 34,
'Symfony\\Contracts\\Cache\\' => 24,
'Symfony\\Component\\Yaml\\' => 23,
'Symfony\\Component\\VarExporter\\' => 30,
'Symfony\\Component\\VarDumper\\' => 28,
'Symfony\\Component\\Validator\\' => 28,
'Symfony\\Component\\TypeInfo\\' => 27,
'Symfony\\Component\\String\\' => 25,
'Symfony\\Component\\Stopwatch\\' => 28,
'Symfony\\Component\\Serializer\\' => 29,
'Symfony\\Component\\Runtime\\' => 26,
'Symfony\\Component\\Routing\\' => 26,
'Symfony\\Component\\PropertyInfo\\' => 31,
'Symfony\\Component\\PropertyAccess\\' => 33,
'Symfony\\Component\\Process\\' => 26,
'Symfony\\Component\\HttpKernel\\' => 29,
'Symfony\\Component\\HttpFoundation\\' => 33,
'Symfony\\Component\\Finder\\' => 25,
'Symfony\\Component\\Filesystem\\' => 29,
'Symfony\\Component\\EventDispatcher\\' => 34,
'Symfony\\Component\\ErrorHandler\\' => 31,
'Symfony\\Component\\Dotenv\\' => 25,
'Symfony\\Component\\DependencyInjection\\' => 38,
'Symfony\\Component\\Console\\' => 26,
'Symfony\\Component\\Config\\' => 25,
'Symfony\\Component\\Cache\\' => 24,
'Symfony\\Bundle\\MakerBundle\\' => 27,
'Symfony\\Bundle\\FrameworkBundle\\' => 31,
'Symfony\\Bridge\\Doctrine\\' => 24,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\EventDispatcher\\' => 20,
'Psr\\Container\\' => 14,
'Psr\\Cache\\' => 10,
'PhpParser\\' => 10,
'PHPStan\\PhpDocParser\\' => 21,
),
'N' =>
array (
'Nelmio\\CorsBundle\\' => 18,
),
'D' =>
array (
'Doctrine\\SqlFormatter\\' => 22,
'Doctrine\\Persistence\\' => 21,
'Doctrine\\ORM\\' => 13,
'Doctrine\\Migrations\\' => 20,
'Doctrine\\Instantiator\\' => 22,
'Doctrine\\Inflector\\' => 19,
'Doctrine\\Deprecations\\' => 22,
'Doctrine\\DBAL\\' => 14,
'Doctrine\\Common\\Lexer\\' => 22,
'Doctrine\\Common\\Collections\\' => 28,
'Doctrine\\Common\\' => 16,
'Doctrine\\Bundle\\MigrationsBundle\\' => 33,
'Doctrine\\Bundle\\DoctrineBundle\\' => 31,
),
'A' =>
array (
'App\\Tests\\' => 10,
'App\\' => 4,
),
);
public static $prefixDirsPsr4 = array (
'phpDocumentor\\Reflection\\' =>
array (
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
2 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
),
'Webmozart\\Assert\\' =>
array (
0 => __DIR__ . '/..' . '/webmozart/assert/src',
),
'Symfony\\Runtime\\Symfony\\Component\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/runtime/Internal',
),
'Symfony\\Polyfill\\Php85\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php85',
),
'Symfony\\Polyfill\\Php84\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php84',
),
'Symfony\\Polyfill\\Php83\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php83',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
),
'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
),
'Symfony\\Flex\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/flex/src',
),
'Symfony\\Contracts\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
),
'Symfony\\Contracts\\Service\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/service-contracts',
),
'Symfony\\Contracts\\EventDispatcher\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts',
),
'Symfony\\Contracts\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/cache-contracts',
),
'Symfony\\Component\\Yaml\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/yaml',
),
'Symfony\\Component\\VarExporter\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/var-exporter',
),
'Symfony\\Component\\VarDumper\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/var-dumper',
),
'Symfony\\Component\\Validator\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/validator',
),
'Symfony\\Component\\TypeInfo\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/type-info',
),
'Symfony\\Component\\String\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/string',
),
'Symfony\\Component\\Stopwatch\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/stopwatch',
),
'Symfony\\Component\\Serializer\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/serializer',
),
'Symfony\\Component\\Runtime\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/runtime',
),
'Symfony\\Component\\Routing\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/routing',
),
'Symfony\\Component\\PropertyInfo\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/property-info',
),
'Symfony\\Component\\PropertyAccess\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/property-access',
),
'Symfony\\Component\\Process\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/process',
),
'Symfony\\Component\\HttpKernel\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/http-kernel',
),
'Symfony\\Component\\HttpFoundation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/http-foundation',
),
'Symfony\\Component\\Finder\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/finder',
),
'Symfony\\Component\\Filesystem\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/filesystem',
),
'Symfony\\Component\\EventDispatcher\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/event-dispatcher',
),
'Symfony\\Component\\ErrorHandler\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/error-handler',
),
'Symfony\\Component\\Dotenv\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/dotenv',
),
'Symfony\\Component\\DependencyInjection\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/dependency-injection',
),
'Symfony\\Component\\Console\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/console',
),
'Symfony\\Component\\Config\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/config',
),
'Symfony\\Component\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/cache',
),
'Symfony\\Bundle\\MakerBundle\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/maker-bundle/src',
),
'Symfony\\Bundle\\FrameworkBundle\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/framework-bundle',
),
'Symfony\\Bridge\\Doctrine\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/doctrine-bridge',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/src',
),
'Psr\\EventDispatcher\\' =>
array (
0 => __DIR__ . '/..' . '/psr/event-dispatcher/src',
),
'Psr\\Container\\' =>
array (
0 => __DIR__ . '/..' . '/psr/container/src',
),
'Psr\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/cache/src',
),
'PhpParser\\' =>
array (
0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser',
),
'PHPStan\\PhpDocParser\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
),
'Nelmio\\CorsBundle\\' =>
array (
0 => __DIR__ . '/..' . '/nelmio/cors-bundle',
),
'Doctrine\\SqlFormatter\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/sql-formatter/src',
),
'Doctrine\\Persistence\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/persistence/src/Persistence',
),
'Doctrine\\ORM\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/orm/src',
),
'Doctrine\\Migrations\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/migrations/src',
),
'Doctrine\\Instantiator\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
),
'Doctrine\\Inflector\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/inflector/src',
),
'Doctrine\\Deprecations\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/deprecations/src',
),
'Doctrine\\DBAL\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/dbal/src',
),
'Doctrine\\Common\\Lexer\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/lexer/src',
),
'Doctrine\\Common\\Collections\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/collections/src',
),
'Doctrine\\Common\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/event-manager/src',
),
'Doctrine\\Bundle\\MigrationsBundle\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/doctrine-migrations-bundle/src',
),
'Doctrine\\Bundle\\DoctrineBundle\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/doctrine-bundle/src',
),
'App\\Tests\\' =>
array (
0 => __DIR__ . '/../..' . '/tests',
),
'App\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'DateError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateError.php',
'DateException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateException.php',
'DateInvalidOperationException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php',
'DateInvalidTimeZoneException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php',
'DateMalformedIntervalStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php',
'DateMalformedPeriodStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php',
'DateMalformedStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php',
'DateObjectError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php',
'DateRangeError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php',
'Deprecated' => __DIR__ . '/..' . '/symfony/polyfill-php84/Resources/stubs/Deprecated.php',
'NoDiscard' => __DIR__ . '/..' . '/symfony/polyfill-php85/Resources/stubs/NoDiscard.php',
'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
'Override' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/Override.php',
'ReflectionConstant' => __DIR__ . '/..' . '/symfony/polyfill-php84/Resources/stubs/ReflectionConstant.php',
'SQLite3Exception' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
'©' => __DIR__ . '/..' . '/symfony/cache/Traits/ValueWrapper.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit75e7f8d848176580e9902a32f6f14640::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit75e7f8d848176580e9902a32f6f14640::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit75e7f8d848176580e9902a32f6f14640::$classMap;
}, null, ClassLoader::class);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,686 +0,0 @@
<?php return array(
'root' => array(
'name' => 'symfony/skeleton',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '2f96caaa233f92fb18ffcdc3f13805d0e7e41369',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'doctrine/collections' => array(
'pretty_version' => '2.6.0',
'version' => '2.6.0.0',
'reference' => '7713da39d8e237f28411d6a616a3dce5e20d5de2',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/collections',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/dbal' => array(
'pretty_version' => '4.4.3',
'version' => '4.4.3.0',
'reference' => '61e730f1658814821a85f2402c945f3883407dec',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/dbal',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/deprecations' => array(
'pretty_version' => '1.1.6',
'version' => '1.1.6.0',
'reference' => 'd4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/deprecations',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/doctrine-bundle' => array(
'pretty_version' => '2.18.2',
'version' => '2.18.2.0',
'reference' => '0ff098b29b8b3c68307c8987dcaed7fd829c6546',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../doctrine/doctrine-bundle',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/doctrine-migrations-bundle' => array(
'pretty_version' => '3.7.0',
'version' => '3.7.0.0',
'reference' => '1e380c6dd8ac8488217f39cff6b77e367f1a644b',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../doctrine/doctrine-migrations-bundle',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/event-manager' => array(
'pretty_version' => '2.1.1',
'version' => '2.1.1.0',
'reference' => 'dda33921b198841ca8dbad2eaa5d4d34769d18cf',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/event-manager',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/inflector' => array(
'pretty_version' => '2.1.0',
'version' => '2.1.0.0',
'reference' => '6d6c96277ea252fc1304627204c3d5e6e15faa3b',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/inflector',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/instantiator' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'reference' => 'c6222283fa3f4ac679f8b9ced9a4e23f163e80d0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/instantiator',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/lexer' => array(
'pretty_version' => '3.0.1',
'version' => '3.0.1.0',
'reference' => '31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/lexer',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/migrations' => array(
'pretty_version' => '3.9.6',
'version' => '3.9.6.0',
'reference' => 'ffd8355cdd8505fc650d9604f058bf62aedd80a1',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/migrations',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/orm' => array(
'pretty_version' => '3.6.2',
'version' => '3.6.2.0',
'reference' => '4262eb495b4d2a53b45de1ac58881e0091f2970f',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/orm',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/persistence' => array(
'pretty_version' => '4.1.1',
'version' => '4.1.1.0',
'reference' => 'b9c49ad3558bb77ef973f4e173f2e9c2eca9be09',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/persistence',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/sql-formatter' => array(
'pretty_version' => '1.5.4',
'version' => '1.5.4.0',
'reference' => '9563949f5cd3bd12a17d12fb980528bc141c5806',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/sql-formatter',
'aliases' => array(),
'dev_requirement' => false,
),
'nelmio/cors-bundle' => array(
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'reference' => '3d80dbcd5d1eb5f8b20ed5199e1778d44c2e4d1c',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../nelmio/cors-bundle',
'aliases' => array(),
'dev_requirement' => false,
),
'nikic/php-parser' => array(
'pretty_version' => 'v5.7.0',
'version' => '5.7.0.0',
'reference' => 'dca41cd15c2ac9d055ad70dbfd011130757d1f82',
'type' => 'library',
'install_path' => __DIR__ . '/../nikic/php-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'phpdocumentor/reflection-common' => array(
'pretty_version' => '2.2.0',
'version' => '2.2.0.0',
'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-common',
'aliases' => array(),
'dev_requirement' => false,
),
'phpdocumentor/reflection-docblock' => array(
'pretty_version' => '6.0.3',
'version' => '6.0.3.0',
'reference' => '7bae67520aa9f5ecc506d646810bd40d9da54582',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
'aliases' => array(),
'dev_requirement' => false,
),
'phpdocumentor/type-resolver' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'reference' => '327a05bbee54120d4786a0dc67aad30226ad4cf9',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
'aliases' => array(),
'dev_requirement' => false,
),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '2.3.2',
'version' => '2.3.2.0',
'reference' => 'a004701b11273a26cd7955a61d67a7f1e525a45a',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/cache' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '2.0|3.0',
),
),
'psr/container' => array(
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/container-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.1|2.0',
),
),
'psr/event-dispatcher' => array(
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/event-dispatcher',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/event-dispatcher-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/log' => array(
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/log-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0|2.0|3.0',
),
),
'psr/simple-cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0|2.0|3.0',
),
),
'symfony/cache' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '665522ec357540e66c294c08583b40ee576574f0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/cache-contracts' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => '5d68a57d66910405e5c0b63d6f0af941e66fc868',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.1|2.0|3.0',
),
),
'symfony/config' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '6c17162555bfb58957a55bb0e43e00035b6ae3d5',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/config',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/console' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => 'e1e6770440fb9c9b0cf725f81d1361ad1835329d',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/dependency-injection' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '0f651e58f4917fb0e2cd261ccbfe3d71e6e0f5db',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dependency-injection',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/doctrine-bridge' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '4fc5e2dd41be3c0b6321e0373072782edeff45ed',
'type' => 'symfony-bridge',
'install_path' => __DIR__ . '/../symfony/doctrine-bridge',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/dotenv' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '7e5529a0b02395cb4614cdf507495a4cef3115c5',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dotenv',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/error-handler' => array(
'pretty_version' => 'v7.4.4',
'version' => '7.4.4.0',
'reference' => '8da531f364ddfee53e36092a7eebbbd0b775f6b8',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/error-handler',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/event-dispatcher' => array(
'pretty_version' => 'v7.4.4',
'version' => '7.4.4.0',
'reference' => 'dc2c0eba1af673e736bb851d747d266108aea746',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/event-dispatcher-contracts' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => '59eb412e93815df44f05f342958efa9f46b1e586',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/event-dispatcher-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '2.0|3.0',
),
),
'symfony/filesystem' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '3ebc794fa5315e59fd122561623c2e2e4280538e',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/finder' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '8655bf1076b7a3a346cb11413ffdabff50c7ffcf',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/flex' => array(
'pretty_version' => 'v2.10.0',
'version' => '2.10.0.0',
'reference' => '9cd384775973eabbf6e8b05784dda279fc67c28d',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../symfony/flex',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/framework-bundle' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => 'c94bc78c85d76af67918404a95d44940f66a7c2f',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/framework-bundle',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/http-foundation' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => 'f94b3e7b7dafd40e666f0c9ff2084133bae41e81',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-foundation',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/http-kernel' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '3b3fcf386c809be990c922e10e4c620d6367cab1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-kernel',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/maker-bundle' => array(
'pretty_version' => 'v1.67.0',
'version' => '1.67.0.0',
'reference' => '6ce8b313845f16bcf385ee3cb31d8b24e30d5516',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/maker-bundle',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-ctype' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-iconv' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '380872130d3a5dd3ace2f4010d95125fde5d5c70',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '3833d7255cc303546435cb650316bff708a1c75c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '6d857f4d76bd4b343eac26d6b539585d2bc56493',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php72' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php73' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php74' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php80' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php81' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php82' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php83' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '17f6f9a6b1735c0f163024d959f700cfbc5155e5',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php83',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php84' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => 'd8ced4d875142b6a7426000426b8abc631d6b191',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php84',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php85' => array(
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => 'd4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php85',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/process' => array(
'pretty_version' => 'v7.4.5',
'version' => '7.4.5.0',
'reference' => '608476f4604102976d687c483ac63a79ba18cc97',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/property-access' => array(
'pretty_version' => 'v7.4.4',
'version' => '7.4.4.0',
'reference' => 'fa49bf1ca8fce1ba0e2dba4e4658554cfb9364b1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-access',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/property-info' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '02501d75fd834345da3ecdd8e3200ced39e370f8',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-info',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/routing' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '238d749c56b804b31a9bf3e26519d93b65a60938',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/routing',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/runtime' => array(
'pretty_version' => 'v7.4.1',
'version' => '7.4.1.0',
'reference' => '876f902a6cb6b26c003de244188c06b2ba1c172f',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../symfony/runtime',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/serializer' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => 'bd395bbc6fabd136a48e1a6f91b09f88b5050b0b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/serializer',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/service-contracts' => array(
'pretty_version' => 'v3.6.1',
'version' => '3.6.1.0',
'reference' => '45112560a3ba2d715666a509a0bc9521d10b6c43',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/service-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/service-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.1|2.0|3.0',
),
),
'symfony/skeleton' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '2f96caaa233f92fb18ffcdc3f13805d0e7e41369',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/stopwatch' => array(
'pretty_version' => 'v7.4.0',
'version' => '7.4.0.0',
'reference' => '8a24af0a2e8a872fb745047180649b8418303084',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/stopwatch',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/string' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '9f209231affa85aa930a5e46e6eb03381424b30b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/translation-contracts' => array(
'pretty_version' => 'v3.6.1',
'version' => '3.6.1.0',
'reference' => '65a8bc82080447fae78373aa10f8d13b38338977',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/type-info' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '31f1e40cbf7851c7354281c90eb1b352c4cb8269',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/type-info',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/validator' => array(
'pretty_version' => 'v7.4.7',
'version' => '7.4.7.0',
'reference' => '3a1a460a9f8c5e5611e15c52c4baa5a62fa3c203',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/validator',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/var-dumper' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '045321c440ac18347b136c63d2e9bf28a2dc0291',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/var-exporter' => array(
'pretty_version' => 'v7.4.0',
'version' => '7.4.0.0',
'reference' => '03a60f169c79a28513a78c967316fbc8bf17816f',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-exporter',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/yaml' => array(
'pretty_version' => 'v7.4.6',
'version' => '7.4.6.0',
'reference' => '58751048de17bae71c5aa0d13cb19d79bca26391',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),
'dev_requirement' => false,
),
'webmozart/assert' => array(
'pretty_version' => '2.1.6',
'version' => '2.1.6.0',
'reference' => 'ff31ad6efc62e66e518fbab1cde3453d389bcdc8',
'type' => 'library',
'install_path' => __DIR__ . '/../webmozart/assert',
'aliases' => array(),
'dev_requirement' => false,
),
),
);

View File

@@ -1,25 +0,0 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 80200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
throw new \RuntimeException(
'Composer detected issues in your platform: ' . implode(' ', $issues)
);
}

View File

@@ -1,44 +0,0 @@
# Contribute to Doctrine
Thank you for contributing to Doctrine!
Before we can merge your Pull-Request here are some guidelines that you need to follow.
These guidelines exist not to annoy you, but to keep the code base clean,
unified and future proof.
## Coding Standard
We use the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard).
## Unit-Tests
Please try to add a test for your pull-request.
* If you want to contribute new functionality add unit- or functional tests
depending on the scope of the feature.
You can run the unit-tests by calling ``vendor/bin/phpunit`` from the root of the project.
It will run all the project tests.
In order to do that, you will need a fresh copy of doctrine/collections, and you
will have to run a composer installation in the project:
```sh
git clone git@github.com:doctrine/collections.git
cd collections
curl -sS https://getcomposer.org/installer | php --
./composer.phar install
```
## Github Actions
We automatically run your pull request through Github Actions against supported
PHP versions. If you break the tests, we cannot merge your code, so please make
sure that your code is working before opening up a Pull-Request.
## Getting merged
Please allow us time to review your pull requests. We will give our best to review
everything as fast as possible, but cannot always live up to our own expectations.
Thank you very much again for your contribution!

View File

@@ -1,19 +0,0 @@
Copyright (c) 2006-2013 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,6 +0,0 @@
# Doctrine Collections
[![Build Status](https://github.com/doctrine/collections/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/collections/actions)
[![Code Coverage](https://codecov.io/gh/doctrine/collections/branch/2.0.x/graph/badge.svg)](https://codecov.io/gh/doctrine/collections/branch/2.0.x)
Collections Abstraction library

View File

@@ -1,151 +0,0 @@
Note about upgrading: Doctrine uses static and runtime mechanisms to raise
awareness about deprecated code.
- Use of `@deprecated` docblock that is detected by IDEs (like PHPStorm) or
Static Analysis tools (like Psalm, phpstan)
- Use of our low-overhead runtime deprecation API, details:
https://github.com/doctrine/deprecations/
# Upgrade to 2.6
When extending `Doctrine\Common\Collections\AbstractLazyCollection`, the
backing collection initialized in `doInitialize()` must implement
`Doctrine\Common\Collections\Selectable`. Initializing with a collection that
does not implement `Selectable` is deprecated and will throw an exception in 3.0.
Also, implementing `ReadableCollection` without implementing `Selectable`
deprecated and will be an error in 3.0.
# Upgrade to 2.5
Extending the following classes is deprecated and will no longer be possible in 3.0:
- `Doctrine\Common\Collections\Criteria`
- `Doctrine\Common\Collections\Expr\ClosureExpressionVisitor`
- `Doctrine\Common\Collections\Expr\Comparison`
- `Doctrine\Common\Collections\Expr\CompositeExpression`
- `Doctrine\Common\Collections\Expr\Value`
- `Doctrine\Common\Collections\ExpressionBuilder`
# Upgrade to 2.4
## Deprecated accessing fields through other means than raw field access when using the criteria filtering API (the `Doctrine\Common\Collections\Selectable` interface)
Starting with the next major version, the only way to access data when using the criteria filtering
API is through direct (reflection-based) access at properties directly, also bypassing property hooks.
This is to ensure consistency with how the ORM/ODM works. See https://github.com/doctrine/collections/pull/472 for
the full motivation.
To opt-in to the new behaviour, pass `true` for the `$accessRawFieldValues` parameter when creating a `Criteria`
object through either `Doctrine\Common\Collections\Criteria::create()` or when calling the `Doctrine\Common\Collections\Criteria` constructor.
Be aware that switching to reflection-based field access may prevent ORM or ODM proxy objects
becoming initialized, since their triggers (like calling public methods) are bypassed. This might lead
to `null` values being read from such objects, which may cause wrong filtering or sorting results.
To avoid this issue, use native lazy objects added in PHP 8.4.
See https://github.com/doctrine/collections/issues/487 for more details on when this may happen.
# Upgrade to 2.2
## Deprecated string representation of sort order
Criteria orderings direction is now represented by the
`Doctrine\Common\Collection\Order` enum.
As a consequence:
- `Criteria::ASC` and `Criteria::DESC` are deprecated in favor of
`Order::Ascending` and `Order::Descending`, respectively.
- `Criteria::getOrderings()` is deprecated in favor of `Criteria::orderings()`,
which returns `array<string, Order>`.
- `Criteria::orderBy()` accepts `array<string, string|Order>`, but passing
anything other than `array<string, Order>` is deprecated.
# Upgrade to 2.0
## BC breaking changes
Native parameter types were added. Native return types will be added in 3.0.x
As a consequence, some signatures were changed and will have to be adjusted in sub-classes.
Note that in order to keep compatibility with both 1.x and 2.x versions,
extending code would have to omit the added parameter types.
This would only work in PHP 7.2+ which is the first version featuring
[parameter widening](https://wiki.php.net/rfc/parameter-no-type-variance).
It is also recommended to add return types according to the tables below
You can find a list of major changes to public API below.
### Doctrine\Common\Collections\Collection
| 1.0.x | 3.0.x |
|---------------------------------:|:-------------------------------------------------|
| `add($element)` | `add(mixed $element): void` |
| `clear()` | `clear(): void` |
| `contains($element)` | `contains(mixed $element): bool` |
| `isEmpty()` | `isEmpty(): bool` |
| `removeElement($element)` | `removeElement(mixed $element): bool` |
| `containsKey($key)` | `containsKey(string\|int $key): bool` |
| `get()` | `get(string\|int $key): mixed` |
| `getKeys()` | `getKeys(): array` |
| `getValues()` | `getValues(): array` |
| `set($key, $value)` | `set(string\|int $key, $value): void` |
| `toArray()` | `toArray(): array` |
| `first()` | `first(): mixed` |
| `last()` | `last(): mixed` |
| `key()` | `key(): int\|string\|null` |
| `current()` | `current(): mixed` |
| `next()` | `next(): mixed` |
| `exists(Closure $p)` | `exists(Closure $p): bool` |
| `filter(Closure $p)` | `filter(Closure $p): self` |
| `forAll(Closure $p)` | `forAll(Closure $p): bool` |
| `map(Closure $func)` | `map(Closure $func): self` |
| `partition(Closure $p)` | `partition(Closure $p): array` |
| `indexOf($element)` | `indexOf(mixed $element): int\|string\|false` |
| `slice($offset, $length = null)` | `slice(int $offset, ?int $length = null): array` |
| `count()` | `count(): int` |
| `getIterator()` | `getIterator(): \Traversable` |
| `offsetSet($offset, $value)` | `offsetSet(mixed $offset, mixed $value): void` |
| `offsetUnset($offset)` | `offsetUnset(mixed $offset): void` |
| `offsetExists($offset)` | `offsetExists(mixed $offset): bool` |
### Doctrine\Common\Collections\AbstractLazyCollection
| 1.0.x | 3.0.x |
|------------------:|:------------------------|
| `isInitialized()` | `isInitialized(): bool` |
| `initialize()` | `initialize(): void` |
| `doInitialize()` | `doInitialize(): void` |
### Doctrine\Common\Collections\ArrayCollection
| 1.0.x | 3.0.x |
|------------------------------:|:--------------------------------------|
| `createFrom(array $elements)` | `createFrom(array $elements): static` |
| `__toString()` | `__toString(): string` |
### Doctrine\Common\Collections\Criteria
| 1.0.x | 3.0.x |
|------------------------------------------:|:--------------------------------------------|
| `where(Expression $expression): self` | `where(Expression $expression): static` |
| `andWhere(Expression $expression): self` | `andWhere(Expression $expression): static` |
| `orWhere(Expression $expression): self` | `orWhere(Expression $expression): static` |
| `orderBy(array $orderings): self` | `orderBy(array $orderings): static` |
| `setFirstResult(?int $firstResult): self` | `setFirstResult(?int $firstResult): static` |
| `setMaxResult(?int $maxResults): self` | `setMaxResults(?int $maxResults): static` |
### Doctrine\Common\Collections\Selectable
| 1.0.x | 3.0.x |
|-------------------------------:|:-------------------------------------------|
| `matching(Criteria $criteria)` | `matching(Criteria $criteria): Collection` |
# Upgrade to 1.7
## Deprecated null first result
Passing null as `$firstResult` to
`Doctrine\Common\Collections\Criteria::__construct()` and to
`Doctrine\Common\Collections\Criteria::setFirstResult()` is deprecated.
Use `0` instead.

View File

@@ -1,63 +0,0 @@
{
"name": "doctrine/collections",
"description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.",
"license": "MIT",
"type": "library",
"keywords": [
"php",
"collections",
"array",
"iterators"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"homepage": "https://www.doctrine-project.org/projects/collections.html",
"require": {
"php": "^8.1",
"doctrine/deprecations": "^1",
"symfony/polyfill-php84": "^1.30"
},
"require-dev": {
"ext-json": "*",
"doctrine/coding-standard": "^14",
"phpstan/phpstan": "^2.1.30",
"phpstan/phpstan-phpunit": "^2.0.7",
"phpunit/phpunit": "^10.5.58 || ^11.5.42 || ^12.4"
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Collections\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\Common\\Collections\\": "tests"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

View File

@@ -1,5 +0,0 @@
{
"require": {
"doctrine/docs-builder": "^1.0"
}
}

View File

@@ -1,26 +0,0 @@
Derived Collections
===================
You can create custom collection classes by extending the
``Doctrine\Common\Collections\ArrayCollection`` class. If the
``__construct`` semantics are different from the default ``ArrayCollection``
you can override the ``createFrom`` method:
.. code-block:: php
final class DerivedArrayCollection extends ArrayCollection
{
/** @var \stdClass */
private $foo;
public function __construct(\stdClass $foo, array $elements = [])
{
$this->foo = $foo;
parent::__construct($elements);
}
protected function createFrom(array $elements) : self
{
return new static($this->foo, $elements);
}
}

View File

@@ -1,195 +0,0 @@
Expression Builder
==================
The Expression Builder is a convenient fluent interface for
building expressions to be used with the ``Doctrine\Common\Collections\Criteria``
class:
.. code-block:: php
$expressionBuilder = Criteria::expr();
$criteria = new Criteria();
$criteria->where($expressionBuilder->eq('name', 'jwage'));
$criteria->orWhere($expressionBuilder->eq('name', 'romanb'));
$collection->matching($criteria);
The ``ExpressionBuilder`` has the following API:
andX
----
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->andX(
$expressionBuilder->eq('foo', 1),
$expressionBuilder->eq('bar', 1)
);
$collection->matching(new Criteria($expression));
orX
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->orX(
$expressionBuilder->eq('foo', 1),
$expressionBuilder->eq('bar', 1)
);
$collection->matching(new Criteria($expression));
not
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->not(
$expressionBuilder->eq('foo', 1)
);
$collection->matching(new Criteria($expression));
eq
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->eq('foo', 1);
$collection->matching(new Criteria($expression));
gt
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->gt('foo', 1);
$collection->matching(new Criteria($expression));
lt
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->lt('foo', 1);
$collection->matching(new Criteria($expression));
gte
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->gte('foo', 1);
$collection->matching(new Criteria($expression));
lte
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->lte('foo', 1);
$collection->matching(new Criteria($expression));
neq
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->neq('foo', 1);
$collection->matching(new Criteria($expression));
isNull
------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->isNull('foo');
$collection->matching(new Criteria($expression));
isNotNull
---------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->isNotNull('foo');
$collection->matching(new Criteria($expression));
in
---
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->in('foo', ['value1', 'value2']);
$collection->matching(new Criteria($expression));
notIn
-----
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->notIn('foo', ['value1', 'value2']);
$collection->matching(new Criteria($expression));
contains
--------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->contains('foo', 'value1');
$collection->matching(new Criteria($expression));
memberOf
--------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->memberOf('foo', ['value1', 'value2']);
$collection->matching(new Criteria($expression));
startsWith
----------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->startsWith('foo', 'hello');
$collection->matching(new Criteria($expression));
endsWith
--------
.. code-block:: php
$expressionBuilder = Criteria::expr();
$expression = $expressionBuilder->endsWith('foo', 'world');
$collection->matching(new Criteria($expression));

View File

@@ -1,117 +0,0 @@
Expressions
===========
The ``Doctrine\Common\Collections\Expr\Comparison`` class
can be used to create comparison expressions to be used with the
``Doctrine\Common\Collections\Criteria`` class. It has the
following operator constants:
- ``Comparison::EQ``
- ``Comparison::NEQ``
- ``Comparison::LT``
- ``Comparison::LTE``
- ``Comparison::GT``
- ``Comparison::GTE``
- ``Comparison::IS``
- ``Comparison::IN``
- ``Comparison::NIN``
- ``Comparison::CONTAINS``
- ``Comparison::MEMBER_OF``
- ``Comparison::STARTS_WITH``
- ``Comparison::ENDS_WITH``
The ``Doctrine\Common\Collections\Expr\CompositeExpression`` class
can be used to create composite expressions to be used with the
``Doctrine\Common\Collections\Criteria`` class. It has the
following operator constants:
- ``CompositeExpression::TYPE_AND``
- ``CompositeExpression::TYPE_OR``
- ``CompositeExpression::TYPE_NOT``
When using the ``TYPE_OR`` and ``TYPE_AND`` operators the
``CompositeExpression`` accepts multiple expressions as parameter
but only one expression can be provided when using the ``NOT`` operator.
The ``Doctrine\Common\Collections\Criteria`` class has the following
API to be used with expressions:
where
-----
Sets the where expression to evaluate when this Criteria is searched for.
.. code-block:: php
$expr = new Comparison('key', Comparison::EQ, 'value');
$criteria->where($expr);
andWhere
--------
Appends the where expression to evaluate when this Criteria is searched for
using an AND with previous expression.
.. code-block:: php
$expr = new Comparison('key', Comparison::EQ, 'value');
$criteria->andWhere($expr);
orWhere
-------
Appends the where expression to evaluate when this Criteria is searched for
using an OR with previous expression.
.. code-block:: php
$expr1 = new Comparison('key', Comparison::EQ, 'value1');
$expr2 = new Comparison('key', Comparison::EQ, 'value2');
$criteria->where($expr1);
$criteria->orWhere($expr2);
orderBy
-------
Sets the ordering of the result of this Criteria.
.. code-block:: php
use Doctrine\Common\Collections\Order;
$criteria->orderBy(['name' => Order::Ascending]);
setFirstResult
--------------
Set the number of first result that this Criteria should return.
.. code-block:: php
$criteria->setFirstResult(0);
getFirstResult
--------------
Gets the current first result option of this Criteria.
.. code-block:: php
$criteria->setFirstResult(10);
echo $criteria->getFirstResult(); // 10
setMaxResults
-------------
Sets the max results that this Criteria should return.
.. code-block:: php
$criteria->setMaxResults(20);
getMaxResults
-------------
Gets the current max results option of this Criteria.
.. code-block:: php
$criteria->setMaxResults(20);
echo $criteria->getMaxResults(); // 20

View File

@@ -1,386 +0,0 @@
Getting Started
===============
Introduction
------------
Doctrine Collections is a library that contains classes for working with
arrays of data. Here is an example using the simple
``Doctrine\Common\Collections\ArrayCollection`` class:
.. code-block:: php
<?php
use Doctrine\Common\Collections\ArrayCollection;
$collection = new ArrayCollection([1, 2, 3]);
$filteredCollection = $collection->filter(static fn ($element): bool => $element > 1); // [2, 3]
Collection Methods
------------------
Doctrine Collections provides an interface named ``Doctrine\Common\Collections\Collection``
that resembles the nature of a regular PHP array. That is,
it is essentially an **ordered map** that can also be used
like a list.
A Collection has an internal iterator just like a PHP array. In addition,
a Collection can be iterated with external iterators, which is preferable.
To use an external iterator simply use the foreach language construct to
iterate over the collection, which calls ``getIterator()`` internally, or
explicitly retrieve an iterator though ``getIterator()`` which can then be
used to iterate over the collection. You can not rely on the internal iterator
of the collection being at a certain position unless you explicitly positioned it before.
Methods that do not alter the collection or have template types
appearing in invariant or contravariant positions are not directly
defined in ``Doctrine\Common\Collections\Collection``, but are inherited
from the ``Doctrine\Common\Collections\ReadableCollection`` interface.
The methods available on the interface are:
add
^^^
Adds an element at the end of the collection.
.. code-block:: php
$collection->add('test');
clear
^^^^^
Clears the collection, removing all elements.
.. code-block:: php
$collection->clear();
contains
^^^^^^^^
Checks whether an element is contained in the collection. This is an O(n) operation, where n is the size of the collection.
.. code-block:: php
$collection = new Collection(['test']);
$contains = $collection->contains('test'); // true
containsKey
^^^^^^^^^^^
Checks whether the collection contains an element with the specified key/index.
.. code-block:: php
$collection = new Collection(['test' => true]);
$contains = $collection->containsKey('test'); // true
current
^^^^^^^
Gets the element of the collection at the current iterator position.
.. code-block:: php
$collection = new Collection(['first', 'second', 'third']);
$current = $collection->current(); // first
get
^^^
Gets the element at the specified key/index.
.. code-block:: php
$collection = new Collection([
'key' => 'value',
]);
$value = $collection->get('key'); // value
getKeys
^^^^^^^
Gets all keys/indices of the collection.
.. code-block:: php
$collection = new Collection(['a', 'b', 'c']);
$keys = $collection->getKeys(); // [0, 1, 2]
getValues
^^^^^^^^^
Gets all values of the collection.
.. code-block:: php
$collection = new Collection([
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
]);
$values = $collection->getValues(); // ['value1', 'value2', 'value3']
isEmpty
^^^^^^^
Checks whether the collection is empty (contains no elements).
.. code-block:: php
$collection = new Collection(['a', 'b', 'c']);
$isEmpty = $collection->isEmpty(); // false
first
^^^^^
Sets the internal iterator to the first element in the collection and returns this element.
.. code-block:: php
$collection = new Collection(['first', 'second', 'third']);
$first = $collection->first(); // first
exists
^^^^^^
Tests for the existence of an element that satisfies the given predicate.
.. code-block:: php
$collection = new Collection(['first', 'second', 'third']);
$exists = $collection->exists(static fn ($key, $value): bool => $value === 'first'); // true
findFirst
^^^^^^^^^
Returns the first element of this collection that satisfies the given predicate.
.. code-block:: php
$collection = new Collection([1, 2, 3, 2, 1]);
$one = $collection->findFirst(static fn (int $key, int $value): bool => $value > 2 && $key > 1); // 3
filter
^^^^^^
Returns all the elements of this collection for which your callback function returns `true`.
The order and keys of the elements are preserved.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$filteredCollection = $collection->filter(static fn ($element): bool => $element > 1); // [2, 3]
forAll
^^^^^^
Tests whether the given predicate holds for all elements of this collection.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$forAll = $collection->forAll(static fn ($key, $value): bool => $value > 1); // false
indexOf
^^^^^^^
Gets the index/key of a given element. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$indexOf = $collection->indexOf(3); // 2
key
^^^
Gets the key/index of the element at the current iterator position.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$collection->next();
$key = $collection->key(); // 1
last
^^^^
Sets the internal iterator to the last element in the collection and returns this element.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$last = $collection->last(); // 3
map
^^^
Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$mappedCollection = $collection->map(static fn (int $value): int => $value + 1); // [2, 3, 4]
reduce
^^^^^^
Applies iteratively the given function to each element in the collection, so as to reduce the collection to a single value.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$reduce = $collection->reduce(static fn (int $accumulator, int $value): int => $accumulator + $value, 0); // 6
next
^^^^
Moves the internal iterator position to the next element and returns this element.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$next = $collection->next(); // 2
partition
^^^^^^^^^
Partitions this collection in two collections according to a predicate. Keys are preserved in the resulting collections.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$mappedCollection = $collection->partition(static fn ($key, $value): bool => $value > 1); // [[2, 3], [1]]
remove
^^^^^^
Removes the element at the specified index from the collection.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$collection->remove(0); // [2, 3]
removeElement
^^^^^^^^^^^^^
Removes the specified element from the collection, if it is found.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$collection->removeElement(3); // [1, 2]
set
^^^
Sets an element in the collection at the specified key/index.
.. code-block:: php
$collection = new ArrayCollection();
$collection->set('name', 'jwage');
slice
^^^^^
Extracts a slice of $length elements starting at position $offset from the Collection. If $length is null it returns all elements from $offset to the end of the Collection. Keys have to be preserved by this method. Calling this method will only return the selected slice and NOT change the elements contained in the collection slice is called on.
.. code-block:: php
$collection = new ArrayCollection([0, 1, 2, 3, 4, 5]);
$slice = $collection->slice(1, 2); // [1, 2]
toArray
^^^^^^^
Gets a native PHP array representation of the collection.
.. code-block:: php
$collection = new ArrayCollection([0, 1, 2, 3, 4, 5]);
$array = $collection->toArray(); // [0, 1, 2, 3, 4, 5]
Selectable Methods
------------------
Some Doctrine Collections, like ``Doctrine\Common\Collections\ArrayCollection``,
implement an interface named ``Doctrine\Common\Collections\Selectable``
that offers the usage of a powerful expressions API, where conditions
can be applied to a collection to get a result with matching elements
only.
matching
^^^^^^^^
Selects all elements from a selectable that match the expression and
returns a new collection containing these elements and preserved keys.
.. code-block:: php
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Expr\Comparison;
$collection = new ArrayCollection([
'wage' => [
'name' => 'jwage',
],
'roman' => [
'name' => 'romanb',
],
]);
$expr = new Comparison('name', '=', 'jwage');
$criteria = new Criteria();
$criteria->where($expr);
$matchingCollection = $collection->matching($criteria); // [ 'wage' => [ 'name' => 'jwage' ]]
You can read more about expressions :ref:`here <expressions>`.
.. note::
Currently, expressions use strict comparison for the ``EQ`` (equal) and ``NEQ`` (not equal)
checks. That makes them behave more naturally as long as only scalar values are involved.
For example, ``'04'`` and ``4`` are *not* equal.
However, this can lead to surprising results when working with objects, especially objects
representing values. ``DateTime`` and ``DateTimeImmutable`` are two widespread examples for
objects that would typically rather be compared by their value than by identity.
Comparative operators like ``GT`` or ``LTE`` as well as ``IN`` and ``NIN`` do
not exhibit this behavior.
Also, multi-dimensional sorting based on non-scalar values will only consider the
next sort criteria for *identical* matches, which may not give the expected results
when objects come into play. Keep this in mind, for example, when sorting by fields that
contain ``DateTime`` or ``DateTimeImmutable`` objects.
.. note::
For collections that contain objects, the field name given to ``Comparison`` will
lead to various access methods being tried in sequence. This behavior is deprecated
as of v2.4.0. Set the ``$accessRawFieldValues`` parameter in the ``Criteria`` constructor
to ``true`` to opt-in to the new behaviour of using direct (reflection-based) field access only.
This will be the only option in the next major version.
Unless you opt in, refer to the ``ClosureExpressionVisitor::getObjectFieldValue()`` method
for the exact order of accessors tried. Roughly speaking, for a field named ``field``,
the following things will be tried in order:
1. ``getField()``, ``isField()`` and ``field()`` as getter methods
2. When the object implements a ``__call`` magic method, invoke it
by calling ``getField()``
3. When the object implements ``ArrayAccess``, use that to access the
``field`` offset
4. When the object contains a ``::$field`` public property that is not
``null``, access it directly
5. Convert snake-case field names to camel case and retry the ``get``, ``is``
and prefixless accessor methods
6. Direct access to ``::$field``, which must be a public property, as a
last resort.

View File

@@ -1,26 +0,0 @@
Lazy Collections
================
To create a lazy collection you can extend the
``Doctrine\Common\Collections\AbstractLazyCollection`` class
and define the ``doInitialize`` method. Here is an example where
we lazily query the database for a collection of user records:
.. code-block:: php
use Doctrine\DBAL\Connection;
class UsersLazyCollection extends AbstractLazyCollection
{
/** @var Connection */
private $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
protected function doInitialize() : void
{
$this->collection = $this->connection->fetchAll('SELECT * FROM users');
}
}

View File

@@ -1,29 +0,0 @@
Serialization
=============
Using (un-)serialize() on a collection is not a supported use-case
and may break when changes on the collection's internals happen in the future.
If a collection needs to be serialized, use ``toArray()`` and reconstruct
the collection manually.
.. code-block:: php
$collection = new ArrayCollection([1, 2, 3]);
$serialized = serialize($collection->toArray());
A reconstruction is also necessary when the collection contains objects with
infinite recursion of dependencies like in this ``json_serialize()`` example:
.. code-block:: php
$foo = new Foo();
$bar = new Bar();
$foo->setBar($bar);
$bar->setFoo($foo);
$collection = new ArrayCollection([$foo]);
$json = json_serialize($collection->toArray()); // recursion detected
Serializer libraries can be used to create the serialization-output to prevent
errors.

View File

@@ -1,11 +0,0 @@
:orphan:
.. toctree::
:depth: 3
index
expressions
expression-builder
derived-collections
lazy-collections
serialization

View File

@@ -1,442 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use Closure;
use Doctrine\Deprecations\Deprecation;
use LogicException;
use ReturnTypeWillChange;
use Traversable;
/**
* Lazy collection that is backed by a concrete collection
*
* @phpstan-template TKey of array-key
* @phpstan-template T
* @template-implements Collection<TKey,T>
* @template-implements Selectable<TKey,T>
*/
abstract class AbstractLazyCollection implements Collection, Selectable
{
/**
* The backed collection to use
*
* @phpstan-var Collection<TKey,T>|null
* @var Collection<mixed>|null
*/
protected Collection|null $collection;
protected bool $initialized = false;
/**
* {@inheritDoc}
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
$this->initialize();
return $this->collection->count();
}
/**
* {@inheritDoc}
*/
public function add(mixed $element)
{
$this->initialize();
$this->collection->add($element);
}
/**
* {@inheritDoc}
*/
public function clear()
{
$this->initialize();
$this->collection->clear();
}
/**
* {@inheritDoc}
*/
public function contains(mixed $element)
{
$this->initialize();
return $this->collection->contains($element);
}
/**
* {@inheritDoc}
*/
public function isEmpty()
{
$this->initialize();
return $this->collection->isEmpty();
}
/**
* {@inheritDoc}
*/
public function remove(string|int $key)
{
$this->initialize();
return $this->collection->remove($key);
}
/**
* {@inheritDoc}
*/
public function removeElement(mixed $element)
{
$this->initialize();
return $this->collection->removeElement($element);
}
/**
* {@inheritDoc}
*/
public function containsKey(string|int $key)
{
$this->initialize();
return $this->collection->containsKey($key);
}
/**
* {@inheritDoc}
*/
public function get(string|int $key)
{
$this->initialize();
return $this->collection->get($key);
}
/**
* {@inheritDoc}
*/
public function getKeys()
{
$this->initialize();
return $this->collection->getKeys();
}
/**
* {@inheritDoc}
*/
public function getValues()
{
$this->initialize();
return $this->collection->getValues();
}
/**
* {@inheritDoc}
*/
public function set(string|int $key, mixed $value)
{
$this->initialize();
$this->collection->set($key, $value);
}
/**
* {@inheritDoc}
*/
public function toArray()
{
$this->initialize();
return $this->collection->toArray();
}
/**
* {@inheritDoc}
*/
public function first()
{
$this->initialize();
return $this->collection->first();
}
/**
* {@inheritDoc}
*/
public function last()
{
$this->initialize();
return $this->collection->last();
}
/**
* {@inheritDoc}
*/
public function key()
{
$this->initialize();
return $this->collection->key();
}
/**
* {@inheritDoc}
*/
public function current()
{
$this->initialize();
return $this->collection->current();
}
/**
* {@inheritDoc}
*/
public function next()
{
$this->initialize();
return $this->collection->next();
}
/**
* {@inheritDoc}
*/
public function exists(Closure $p)
{
$this->initialize();
return $this->collection->exists($p);
}
/**
* {@inheritDoc}
*/
public function findFirst(Closure $p)
{
$this->initialize();
return $this->collection->findFirst($p);
}
/**
* {@inheritDoc}
*/
public function filter(Closure $p)
{
$this->initialize();
return $this->collection->filter($p);
}
/**
* {@inheritDoc}
*/
public function forAll(Closure $p)
{
$this->initialize();
return $this->collection->forAll($p);
}
/**
* {@inheritDoc}
*/
public function map(Closure $func)
{
$this->initialize();
return $this->collection->map($func);
}
/**
* {@inheritDoc}
*/
public function reduce(Closure $func, mixed $initial = null)
{
$this->initialize();
return $this->collection->reduce($func, $initial);
}
/**
* {@inheritDoc}
*/
public function partition(Closure $p)
{
$this->initialize();
return $this->collection->partition($p);
}
/**
* {@inheritDoc}
*
* @template TMaybeContained
*/
public function indexOf(mixed $element)
{
$this->initialize();
return $this->collection->indexOf($element);
}
/**
* {@inheritDoc}
*/
public function slice(int $offset, int|null $length = null)
{
$this->initialize();
return $this->collection->slice($offset, $length);
}
/**
* {@inheritDoc}
*
* @return Traversable<int|string, mixed>
* @phpstan-return Traversable<TKey,T>
*/
#[ReturnTypeWillChange]
public function getIterator()
{
$this->initialize();
return $this->collection->getIterator();
}
/**
* {@inheritDoc}
*
* @param TKey $offset
*
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists(mixed $offset)
{
$this->initialize();
return $this->collection->offsetExists($offset);
}
/**
* {@inheritDoc}
*
* @param TKey $offset
*
* @return T|null
*/
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset)
{
$this->initialize();
return $this->collection->offsetGet($offset);
}
/**
* {@inheritDoc}
*
* @param TKey|null $offset
* @param T $value
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetSet(mixed $offset, mixed $value)
{
$this->initialize();
$this->collection->offsetSet($offset, $value);
}
/**
* @param TKey $offset
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetUnset(mixed $offset)
{
$this->initialize();
$this->collection->offsetUnset($offset);
}
/**
* Is the lazy collection already initialized?
*
* @return bool
*
* @phpstan-assert-if-true Collection<TKey,T> $this->collection
*/
public function isInitialized()
{
return $this->initialized;
}
/**
* Initialize the collection
*
* @return void
*
* @phpstan-assert Collection<TKey,T> $this->collection
*/
protected function initialize()
{
if ($this->initialized) {
return;
}
$this->doInitialize();
$this->initialized = true;
if ($this->collection === null) {
throw new LogicException('You must initialize the collection property in the doInitialize() method.');
}
if ($this->collection instanceof Selectable) {
return;
}
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/518',
'Initializing %s with a collection that does not implement %s is deprecated and will throw an exception in 3.0.',
self::class,
Selectable::class,
);
}
/**
* Do the initialization logic
*
* @return void
*/
abstract protected function doInitialize();
/**
* {@inheritDoc}
*/
public function matching(Criteria $criteria)
{
$this->initialize();
if (! $this->collection instanceof Selectable) {
throw new LogicException('The backed collection must implement Selectable to use matching().');
}
return $this->collection->matching($criteria);
}
}

View File

@@ -1,485 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use ArrayIterator;
use Closure;
use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor;
use ReturnTypeWillChange;
use Stringable;
use Traversable;
use function array_all;
use function array_any;
use function array_filter;
use function array_find;
use function array_key_exists;
use function array_keys;
use function array_map;
use function array_reduce;
use function array_reverse;
use function array_search;
use function array_slice;
use function array_values;
use function count;
use function current;
use function end;
use function in_array;
use function key;
use function next;
use function reset;
use function spl_object_hash;
use function uasort;
use const ARRAY_FILTER_USE_BOTH;
/**
* An ArrayCollection is a Collection implementation that wraps a regular PHP array.
*
* Warning: Using (un-)serialize() on a collection is not a supported use-case
* and may break when we change the internals in the future. If you need to
* serialize a collection use {@link toArray()} and reconstruct the collection
* manually.
*
* @phpstan-template TKey of array-key
* @phpstan-template T
* @template-implements Collection<TKey,T>
* @template-implements Selectable<TKey,T>
* @phpstan-consistent-constructor
*/
class ArrayCollection implements Collection, Selectable, Stringable
{
/**
* An array containing the entries of this collection.
*
* @phpstan-var array<TKey,T>
* @var mixed[]
*/
private array $elements = [];
/**
* Initializes a new ArrayCollection.
*
* @phpstan-param array<TKey,T> $elements
*/
public function __construct(array $elements = [])
{
$this->elements = $elements;
}
/**
* {@inheritDoc}
*/
public function toArray()
{
return $this->elements;
}
/**
* {@inheritDoc}
*/
public function first()
{
return reset($this->elements);
}
/**
* Creates a new instance from the specified elements.
*
* This method is provided for derived classes to specify how a new
* instance should be created when constructor semantics have changed.
*
* @param array $elements Elements.
* @phpstan-param array<K,V> $elements
*
* @return static
* @phpstan-return static<K,V>
*
* @phpstan-template K of array-key
* @phpstan-template V
*/
protected function createFrom(array $elements)
{
return new static($elements);
}
/**
* {@inheritDoc}
*/
public function last()
{
return end($this->elements);
}
/**
* {@inheritDoc}
*/
public function key()
{
return key($this->elements);
}
/**
* {@inheritDoc}
*/
public function next()
{
return next($this->elements);
}
/**
* {@inheritDoc}
*/
public function current()
{
return current($this->elements);
}
/**
* {@inheritDoc}
*/
public function remove(string|int $key)
{
if (! isset($this->elements[$key]) && ! array_key_exists($key, $this->elements)) {
return null;
}
$removed = $this->elements[$key];
unset($this->elements[$key]);
return $removed;
}
/**
* {@inheritDoc}
*/
public function removeElement(mixed $element)
{
$key = array_search($element, $this->elements, true);
if ($key === false) {
return false;
}
unset($this->elements[$key]);
return true;
}
/**
* Required by interface ArrayAccess.
*
* @param TKey $offset
*
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists(mixed $offset)
{
return $this->containsKey($offset);
}
/**
* Required by interface ArrayAccess.
*
* @param TKey $offset
*
* @return T|null
*/
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset)
{
return $this->get($offset);
}
/**
* Required by interface ArrayAccess.
*
* @param TKey|null $offset
* @param T $value
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetSet(mixed $offset, mixed $value)
{
if ($offset === null) {
$this->add($value);
return;
}
/** @phpstan-var TKey $offset */
$this->set($offset, $value);
}
/**
* Required by interface ArrayAccess.
*
* @param TKey $offset
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetUnset(mixed $offset)
{
$this->remove($offset);
}
/**
* {@inheritDoc}
*/
public function containsKey(string|int $key)
{
return isset($this->elements[$key]) || array_key_exists($key, $this->elements);
}
/**
* {@inheritDoc}
*/
public function contains(mixed $element)
{
return in_array($element, $this->elements, true);
}
/**
* {@inheritDoc}
*/
public function exists(Closure $p)
{
return array_any(
$this->elements,
static fn (mixed $element, mixed $key): bool => (bool) $p($key, $element),
);
}
/**
* {@inheritDoc}
*
* @phpstan-param TMaybeContained $element
*
* @return int|string|false
* @phpstan-return (TMaybeContained is T ? TKey|false : false)
*
* @template TMaybeContained
*/
public function indexOf($element)
{
return array_search($element, $this->elements, true);
}
/**
* {@inheritDoc}
*/
public function get(string|int $key)
{
return $this->elements[$key] ?? null;
}
/**
* {@inheritDoc}
*/
public function getKeys()
{
return array_keys($this->elements);
}
/**
* {@inheritDoc}
*/
public function getValues()
{
return array_values($this->elements);
}
/**
* {@inheritDoc}
*
* @return int<0, max>
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->elements);
}
/**
* {@inheritDoc}
*/
public function set(string|int $key, mixed $value)
{
$this->elements[$key] = $value;
}
/**
* {@inheritDoc}
*
* This breaks assumptions about the template type, but it would
* be a backwards-incompatible change to remove this method
*/
public function add(mixed $element)
{
$this->elements[] = $element;
}
/**
* {@inheritDoc}
*/
public function isEmpty()
{
return empty($this->elements);
}
/**
* {@inheritDoc}
*
* @return Traversable<int|string, mixed>
* @phpstan-return Traversable<TKey, T>
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->elements);
}
/**
* {@inheritDoc}
*
* @phpstan-param Closure(T):U $func
*
* @return static
* @phpstan-return static<TKey, U>
*
* @phpstan-template U
*/
public function map(Closure $func)
{
return $this->createFrom(array_map($func, $this->elements));
}
/**
* {@inheritDoc}
*/
public function reduce(Closure $func, $initial = null)
{
return array_reduce($this->elements, $func, $initial);
}
/**
* {@inheritDoc}
*
* @phpstan-param Closure(T, TKey):bool $p
*
* @return static
* @phpstan-return static<TKey,T>
*/
public function filter(Closure $p)
{
return $this->createFrom(array_filter($this->elements, $p, ARRAY_FILTER_USE_BOTH));
}
/**
* {@inheritDoc}
*/
public function findFirst(Closure $p)
{
return array_find(
$this->elements,
static fn (mixed $element, mixed $key): bool => (bool) $p($key, $element),
);
}
/**
* {@inheritDoc}
*/
public function forAll(Closure $p)
{
return array_all(
$this->elements,
static fn (mixed $element, mixed $key): bool => (bool) $p($key, $element),
);
}
/**
* {@inheritDoc}
*/
public function partition(Closure $p)
{
$matches = $noMatches = [];
foreach ($this->elements as $key => $element) {
if ($p($key, $element)) {
$matches[$key] = $element;
} else {
$noMatches[$key] = $element;
}
}
return [$this->createFrom($matches), $this->createFrom($noMatches)];
}
/**
* Returns a string representation of this object.
* {@inheritDoc}
*
* @return string
*/
#[ReturnTypeWillChange]
public function __toString()
{
return self::class . '@' . spl_object_hash($this);
}
/**
* {@inheritDoc}
*/
public function clear()
{
$this->elements = [];
}
/**
* {@inheritDoc}
*/
public function slice(int $offset, int|null $length = null)
{
return array_slice($this->elements, $offset, $length, true);
}
/** @phpstan-return Collection<TKey, T>&Selectable<TKey,T> */
public function matching(Criteria $criteria)
{
$accessRawFieldValues = $criteria->isRawFieldValueAccessEnabled();
$expr = $criteria->getWhereExpression();
$filtered = $this->elements;
if ($expr) {
$visitor = new ClosureExpressionVisitor($accessRawFieldValues);
$filter = $visitor->dispatch($expr);
$filtered = array_filter($filtered, $filter);
}
$orderings = $criteria->orderings();
if ($orderings) {
$next = null;
foreach (array_reverse($orderings) as $field => $ordering) {
$next = ClosureExpressionVisitor::sortByField($field, $ordering === Order::Descending ? -1 : 1, $next, $accessRawFieldValues);
}
uasort($filtered, $next);
}
$offset = $criteria->getFirstResult();
$length = $criteria->getMaxResults();
if ($offset !== null && $offset > 0 || $length !== null && $length > 0) {
$filtered = array_slice($filtered, (int) $offset, $length, true);
}
return $this->createFrom($filtered);
}
}

View File

@@ -1,117 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use ArrayAccess;
use Closure;
/**
* The missing (SPL) Collection/Array/OrderedMap interface.
*
* A Collection resembles the nature of a regular PHP array. That is,
* it is essentially an <b>ordered map</b> that can also be used
* like a list.
*
* A Collection has an internal iterator just like a PHP array. In addition,
* a Collection can be iterated with external iterators, which is preferable.
* To use an external iterator simply use the foreach language construct to
* iterate over the collection (which calls {@link getIterator()} internally) or
* explicitly retrieve an iterator though {@link getIterator()} which can then be
* used to iterate over the collection.
* You can not rely on the internal iterator of the collection being at a certain
* position unless you explicitly positioned it before. Prefer iteration with
* external iterators.
*
* @phpstan-template TKey of array-key
* @phpstan-template T
* @template-extends ReadableCollection<TKey, T>
* @template-extends ArrayAccess<TKey, T>
*/
interface Collection extends ReadableCollection, ArrayAccess
{
/**
* Adds an element at the end of the collection.
*
* @param mixed $element The element to add.
* @phpstan-param T $element
*
* @return void we will require a native return type declaration in 3.0
*/
public function add(mixed $element);
/**
* Clears the collection, removing all elements.
*
* @return void
*/
public function clear();
/**
* Removes the element at the specified index from the collection.
*
* @param string|int $key The key/index of the element to remove.
* @phpstan-param TKey $key
*
* @return mixed The removed element or NULL, if the collection did not contain the element.
* @phpstan-return T|null
*/
public function remove(string|int $key);
/**
* Removes the specified element from the collection, if it is found.
*
* @param mixed $element The element to remove.
* @phpstan-param T $element
*
* @return bool TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeElement(mixed $element);
/**
* Sets an element in the collection at the specified key/index.
*
* @param string|int $key The key/index of the element to set.
* @param mixed $value The element to set.
* @phpstan-param TKey $key
* @phpstan-param T $value
*
* @return void
*/
public function set(string|int $key, mixed $value);
/**
* {@inheritDoc}
*
* @phpstan-param Closure(T):U $func
*
* @return Collection<mixed>
* @phpstan-return Collection<TKey, U>
*
* @phpstan-template U
*/
public function map(Closure $func);
/**
* {@inheritDoc}
*
* @phpstan-param Closure(T, TKey):bool $p
*
* @return Collection<mixed> A collection with the results of the filter operation.
* @phpstan-return Collection<TKey, T>
*/
public function filter(Closure $p);
/**
* {@inheritDoc}
*
* @phpstan-param Closure(TKey, T):bool $p
*
* @return Collection<mixed>[] An array with two elements. The first element contains the collection
* of elements where the predicate returned TRUE, the second element
* contains the collection of elements where the predicate returned FALSE.
* @phpstan-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>}
*/
public function partition(Closure $p);
}

View File

@@ -1,308 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use Doctrine\Common\Collections\Expr\CompositeExpression;
use Doctrine\Common\Collections\Expr\Expression;
use Doctrine\Deprecations\Deprecation;
use function array_map;
use function func_get_arg;
use function func_num_args;
use function strtoupper;
/**
* Criteria for filtering Selectable collections.
*
* @phpstan-consistent-constructor
* @final since 2.5
*/
class Criteria
{
/** @deprecated use Order::Ascending instead */
final public const ASC = 'ASC';
/** @deprecated use Order::Descending instead */
final public const DESC = 'DESC';
private static ExpressionBuilder|null $expressionBuilder = null;
/** @var array<string, Order> */
private array $orderings = [];
private int|null $firstResult = null;
private int|null $maxResults = null;
/**
* Creates an instance of the class.
*
* @return static
*/
public static function create(/* bool $accessRawFieldValues = false */): self
{
$accessRawFieldValues = 0 < func_num_args() ? func_get_arg(0) : false;
return new static(firstResult: 0, accessRawFieldValues: $accessRawFieldValues);
}
/**
* Returns the expression builder.
*
* @return ExpressionBuilder
*/
public static function expr()
{
if (self::$expressionBuilder === null) {
self::$expressionBuilder = new ExpressionBuilder();
}
return self::$expressionBuilder;
}
/**
* Construct a new Criteria.
*
* @param int|null $firstResult
* @param array<string, string|Order>|null $orderings
*/
public function __construct(
private Expression|null $expression = null,
array|null $orderings = null,
int|Placeholder|null $firstResult = Placeholder::NotSpecified,
int|null $maxResults = null,
private bool $accessRawFieldValues = false,
) {
if (! $accessRawFieldValues) {
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/472',
'Not enabling raw field value access for the Criteria matching API in %s is deprecated. Raw field access will be the only supported method in 3.0',
self::class,
);
}
if ($firstResult === null) {
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/311',
'Passing null as $firstResult to the constructor of %s is deprecated. Pass 0 instead or omit the argument.',
self::class,
);
}
if ($firstResult === Placeholder::NotSpecified) {
$firstResult = null;
}
$this->setFirstResult($firstResult);
$this->setMaxResults($maxResults);
if ($orderings === null) {
return;
}
$this->orderBy($orderings);
}
/**
* Sets the where expression to evaluate when this Criteria is searched for.
*
* @return $this
*/
public function where(Expression $expression)
{
$this->expression = $expression;
return $this;
}
/**
* Appends the where expression to evaluate when this Criteria is searched for
* using an AND with previous expression.
*
* @return $this
*/
public function andWhere(Expression $expression)
{
if ($this->expression === null) {
return $this->where($expression);
}
$this->expression = new CompositeExpression(
CompositeExpression::TYPE_AND,
[$this->expression, $expression],
);
return $this;
}
/**
* Appends the where expression to evaluate when this Criteria is searched for
* using an OR with previous expression.
*
* @return $this
*/
public function orWhere(Expression $expression)
{
if ($this->expression === null) {
return $this->where($expression);
}
$this->expression = new CompositeExpression(
CompositeExpression::TYPE_OR,
[$this->expression, $expression],
);
return $this;
}
/**
* Gets the expression attached to this Criteria.
*
* @return Expression|null
*/
public function getWhereExpression()
{
return $this->expression;
}
/**
* Gets the current orderings of this Criteria.
*
* @deprecated use orderings() instead
*
* @return array<string, string>
*/
public function getOrderings()
{
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/389',
'Calling %s() is deprecated. Use %s::orderings() instead.',
__METHOD__,
self::class,
);
return array_map(
static fn (Order $ordering): string => $ordering->value,
$this->orderings,
);
}
/**
* Gets the current orderings of this Criteria.
*
* @return array<string, Order>
*/
public function orderings(): array
{
return $this->orderings;
}
/**
* Sets the ordering of the result of this Criteria.
*
* Keys are field and values are the order, being a valid Order enum case.
*
* @see Order::Ascending
* @see Order::Descending
*
* @param array<string, string|Order> $orderings
*
* @return $this
*/
public function orderBy(array $orderings)
{
$method = __METHOD__;
$this->orderings = array_map(
static function (string|Order $ordering) use ($method): Order {
if ($ordering instanceof Order) {
return $ordering;
}
static $triggered = false;
if (! $triggered) {
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/389',
'Passing non-Order enum values to %s() is deprecated. Pass Order enum values instead.',
$method,
);
}
$triggered = true;
return strtoupper($ordering) === Order::Ascending->value ? Order::Ascending : Order::Descending;
},
$orderings,
);
return $this;
}
/**
* Gets the current first result option of this Criteria.
*
* @return int|null
*/
public function getFirstResult()
{
return $this->firstResult;
}
/**
* Set the number of first result that this Criteria should return.
*
* @param int|null $firstResult The value to set.
*
* @return $this
*/
public function setFirstResult(int|null $firstResult)
{
if ($firstResult === null) {
Deprecation::triggerIfCalledFromOutside(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/311',
'Passing null to %s() is deprecated, pass 0 instead.',
__METHOD__,
);
}
$this->firstResult = $firstResult;
return $this;
}
/**
* Gets maxResults.
*
* @return int|null
*/
public function getMaxResults()
{
return $this->maxResults;
}
/**
* Sets maxResults.
*
* @param int|null $maxResults The value to set.
*
* @return $this
*/
public function setMaxResults(int|null $maxResults)
{
$this->maxResults = $maxResults;
return $this;
}
/** @internal */
public function isRawFieldValueAccessEnabled(): bool
{
return $this->accessRawFieldValues;
}
}

View File

@@ -1,272 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
use ArrayAccess;
use Closure;
use Doctrine\Deprecations\Deprecation;
use ReflectionClass;
use RuntimeException;
use function array_all;
use function array_any;
use function explode;
use function func_get_arg;
use function func_num_args;
use function in_array;
use function is_array;
use function is_scalar;
use function iterator_to_array;
use function method_exists;
use function preg_match;
use function preg_replace_callback;
use function sprintf;
use function str_contains;
use function str_ends_with;
use function str_starts_with;
use function strtoupper;
use const PHP_VERSION_ID;
/**
* Walks an expression graph and turns it into a PHP closure.
*
* This closure can be used with {@Collection#filter()} and is used internally
* by {@ArrayCollection#select()}.
*
* @final since 2.5
*/
class ClosureExpressionVisitor extends ExpressionVisitor
{
public function __construct(
private readonly bool $accessRawFieldValues = false,
) {
}
/**
* Accesses the field of a given object. This field has to be public
* directly or indirectly (through an accessor get*, is*, or a magic
* method, __get, __call).
*
* @param object|mixed[] $object
*
* @return mixed
*/
public static function getObjectFieldValue(object|array $object, string $field, /* bool $accessRawFieldValues = false */)
{
$accessRawFieldValues = 3 <= func_num_args() ? func_get_arg(2) : false;
if (str_contains($field, '.')) {
[$field, $subField] = explode('.', $field, 2);
$object = self::getObjectFieldValue($object, $field, $accessRawFieldValues);
return self::getObjectFieldValue($object, $subField, $accessRawFieldValues);
}
if (is_array($object)) {
return $object[$field];
}
if ($accessRawFieldValues) {
return self::getNearestFieldValue($object, $field);
}
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/472',
'Not enabling raw field value access for %s is deprecated. Raw field access will be the only supported method in 3.0',
__METHOD__,
);
$accessors = ['get', 'is', ''];
foreach ($accessors as $accessor) {
$accessor .= $field;
if (method_exists($object, $accessor)) {
return $object->$accessor();
}
}
if (preg_match('/^is[A-Z]+/', $field) === 1 && method_exists($object, $field)) {
return $object->$field();
}
// __call should be triggered for get.
$accessor = $accessors[0] . $field;
if (method_exists($object, '__call')) {
return $object->$accessor();
}
if ($object instanceof ArrayAccess) {
return $object[$field];
}
if (isset($object->$field)) {
return $object->$field;
}
// camelcase field name to support different variable naming conventions
$ccField = preg_replace_callback('/_(.?)/', static fn ($matches) => strtoupper((string) $matches[1]), $field);
foreach ($accessors as $accessor) {
$accessor .= $ccField;
if (method_exists($object, $accessor)) {
return $object->$accessor();
}
}
return $object->$field;
}
private static function getNearestFieldValue(object $object, string $field): mixed
{
$reflectionClass = new ReflectionClass($object);
while ($reflectionClass && ! $reflectionClass->hasProperty($field)) {
$reflectionClass = $reflectionClass->getParentClass();
}
if ($reflectionClass === false) {
throw new RuntimeException(sprintf('Field "%s" does not exist in class "%s"', $field, $object::class));
}
$property = $reflectionClass->getProperty($field);
if (PHP_VERSION_ID >= 80400) {
return $property->getRawValue($object);
}
return $property->getValue($object);
}
/**
* Helper for sorting arrays of objects based on multiple fields + orientations.
*
* @return Closure
*/
public static function sortByField(string $name, int $orientation = 1, Closure|null $next = null, /* bool $accessRawFieldValues = false */)
{
$accessRawFieldValues = 4 <= func_num_args() ? func_get_arg(3) : false;
if (! $accessRawFieldValues) {
Deprecation::trigger(
'doctrine/collections',
'https://github.com/doctrine/collections/pull/472',
'Not enabling raw field value access for %s is deprecated. Raw field access will be the only supported method in 3.0',
__METHOD__,
);
}
if (! $next) {
$next = static fn (): int => 0;
}
return static function ($a, $b) use ($name, $next, $orientation, $accessRawFieldValues): int {
$aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name, $accessRawFieldValues);
$bValue = ClosureExpressionVisitor::getObjectFieldValue($b, $name, $accessRawFieldValues);
if ($aValue === $bValue) {
return $next($a, $b);
}
return ($aValue > $bValue ? 1 : -1) * $orientation;
};
}
/**
* {@inheritDoc}
*/
public function walkComparison(Comparison $comparison)
{
$field = $comparison->getField();
$value = $comparison->getValue()->getValue();
return match ($comparison->getOperator()) {
Comparison::EQ => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) === $value,
Comparison::NEQ => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) !== $value,
Comparison::LT => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) < $value,
Comparison::LTE => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) <= $value,
Comparison::GT => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) > $value,
Comparison::GTE => fn ($object): bool => self::getObjectFieldValue($object, $field, $this->accessRawFieldValues) >= $value,
Comparison::IN => function ($object) use ($field, $value): bool {
$fieldValue = ClosureExpressionVisitor::getObjectFieldValue($object, $field, $this->accessRawFieldValues);
return in_array($fieldValue, $value, is_scalar($fieldValue));
},
Comparison::NIN => function ($object) use ($field, $value): bool {
$fieldValue = ClosureExpressionVisitor::getObjectFieldValue($object, $field, $this->accessRawFieldValues);
return ! in_array($fieldValue, $value, is_scalar($fieldValue));
},
Comparison::CONTAINS => fn ($object): bool => str_contains((string) self::getObjectFieldValue($object, $field, $this->accessRawFieldValues), (string) $value),
Comparison::MEMBER_OF => function ($object) use ($field, $value): bool {
$fieldValues = ClosureExpressionVisitor::getObjectFieldValue($object, $field, $this->accessRawFieldValues);
if (! is_array($fieldValues)) {
$fieldValues = iterator_to_array($fieldValues);
}
return in_array($value, $fieldValues, true);
},
Comparison::STARTS_WITH => fn ($object): bool => str_starts_with((string) self::getObjectFieldValue($object, $field, $this->accessRawFieldValues), (string) $value),
Comparison::ENDS_WITH => fn ($object): bool => str_ends_with((string) self::getObjectFieldValue($object, $field, $this->accessRawFieldValues), (string) $value),
default => throw new RuntimeException('Unknown comparison operator: ' . $comparison->getOperator()),
};
}
/**
* {@inheritDoc}
*/
public function walkValue(Value $value)
{
return $value->getValue();
}
/**
* {@inheritDoc}
*/
public function walkCompositeExpression(CompositeExpression $expr)
{
$expressionList = [];
foreach ($expr->getExpressionList() as $child) {
$expressionList[] = $this->dispatch($child);
}
return match ($expr->getType()) {
CompositeExpression::TYPE_AND => $this->andExpressions($expressionList),
CompositeExpression::TYPE_OR => $this->orExpressions($expressionList),
CompositeExpression::TYPE_NOT => $this->notExpression($expressionList),
default => throw new RuntimeException('Unknown composite ' . $expr->getType()),
};
}
/** @param callable[] $expressions */
private function andExpressions(array $expressions): Closure
{
return static fn ($object): bool => array_all(
$expressions,
static fn (callable $expression): bool => (bool) $expression($object),
);
}
/** @param callable[] $expressions */
private function orExpressions(array $expressions): Closure
{
return static fn ($object): bool => array_any(
$expressions,
static fn (callable $expression): bool => (bool) $expression($object),
);
}
/** @param callable[] $expressions */
private function notExpression(array $expressions): Closure
{
return static fn ($object) => ! $expressions[0]($object);
}
}

View File

@@ -1,64 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
/**
* Comparison of a field with a value by the given operator.
*
* @final since 2.5
*/
class Comparison implements Expression
{
final public const EQ = '=';
final public const NEQ = '<>';
final public const LT = '<';
final public const LTE = '<=';
final public const GT = '>';
final public const GTE = '>=';
final public const IS = '='; // no difference with EQ
final public const IN = 'IN';
final public const NIN = 'NIN';
final public const CONTAINS = 'CONTAINS';
final public const MEMBER_OF = 'MEMBER_OF';
final public const STARTS_WITH = 'STARTS_WITH';
final public const ENDS_WITH = 'ENDS_WITH';
private readonly Value $value;
public function __construct(private readonly string $field, private readonly string $op, mixed $value)
{
if (! ($value instanceof Value)) {
$value = new Value($value);
}
$this->value = $value;
}
/** @return string */
public function getField()
{
return $this->field;
}
/** @return Value */
public function getValue()
{
return $this->value;
}
/** @return string */
public function getOperator()
{
return $this->op;
}
/**
* {@inheritDoc}
*/
public function visit(ExpressionVisitor $visitor)
{
return $visitor->walkComparison($this);
}
}

View File

@@ -1,72 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
use RuntimeException;
use function count;
/**
* Expression of Expressions combined by AND or OR operation.
*
* @final since 2.5
*/
class CompositeExpression implements Expression
{
final public const TYPE_AND = 'AND';
final public const TYPE_OR = 'OR';
final public const TYPE_NOT = 'NOT';
/** @var list<Expression> */
private array $expressions = [];
/**
* @param Expression[] $expressions
*
* @throws RuntimeException
*/
public function __construct(private readonly string $type, array $expressions)
{
foreach ($expressions as $expr) {
if ($expr instanceof Value) {
throw new RuntimeException('Values are not supported expressions as children of and/or expressions.');
}
if (! ($expr instanceof Expression)) {
throw new RuntimeException('No expression given to CompositeExpression.');
}
$this->expressions[] = $expr;
}
if ($type === self::TYPE_NOT && count($this->expressions) !== 1) {
throw new RuntimeException('Not expression only allows one expression as child.');
}
}
/**
* Returns the list of expressions nested in this composite.
*
* @return list<Expression>
*/
public function getExpressionList()
{
return $this->expressions;
}
/** @return string */
public function getType()
{
return $this->type;
}
/**
* {@inheritDoc}
*/
public function visit(ExpressionVisitor $visitor)
{
return $visitor->walkCompositeExpression($this);
}
}

View File

@@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
/**
* Expression for the {@link Selectable} interface.
*/
interface Expression
{
/** @return mixed */
public function visit(ExpressionVisitor $visitor);
}

View File

@@ -1,43 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
/**
* An Expression visitor walks a graph of expressions and turns them into a
* query for the underlying implementation.
*/
abstract class ExpressionVisitor
{
/**
* Converts a comparison expression into the target query language output.
*
* @return mixed
*/
abstract public function walkComparison(Comparison $comparison);
/**
* Converts a value expression into the target query language part.
*
* @return mixed
*/
abstract public function walkValue(Value $value);
/**
* Converts a composite expression into the target query language output.
*
* @return mixed
*/
abstract public function walkCompositeExpression(CompositeExpression $expr);
/**
* Dispatches walking an expression to the appropriate handler.
*
* @return mixed
*/
public function dispatch(Expression $expr)
{
return $expr->visit($this);
}
}

View File

@@ -1,27 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections\Expr;
/** @final since 2.5 */
class Value implements Expression
{
public function __construct(private readonly mixed $value)
{
}
/** @return mixed */
public function getValue()
{
return $this->value;
}
/**
* {@inheritDoc}
*/
public function visit(ExpressionVisitor $visitor)
{
return $visitor->walkValue($this);
}
}

View File

@@ -1,130 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use Doctrine\Common\Collections\Expr\Comparison;
use Doctrine\Common\Collections\Expr\CompositeExpression;
use Doctrine\Common\Collections\Expr\Expression;
use Doctrine\Common\Collections\Expr\Value;
/**
* Builder for Expressions in the {@link Selectable} interface.
*
* Important Notice for interoperable code: You have to use scalar
* values only for comparisons, otherwise the behavior of the comparison
* may be different between implementations (Array vs ORM vs ODM).
*
* @final since 2.5
*/
class ExpressionBuilder
{
/** @return CompositeExpression */
public function andX(Expression ...$expressions)
{
return new CompositeExpression(CompositeExpression::TYPE_AND, $expressions);
}
/** @return CompositeExpression */
public function orX(Expression ...$expressions)
{
return new CompositeExpression(CompositeExpression::TYPE_OR, $expressions);
}
public function not(Expression $expression): CompositeExpression
{
return new CompositeExpression(CompositeExpression::TYPE_NOT, [$expression]);
}
/** @return Comparison */
public function eq(string $field, mixed $value)
{
return new Comparison($field, Comparison::EQ, new Value($value));
}
/** @return Comparison */
public function gt(string $field, mixed $value)
{
return new Comparison($field, Comparison::GT, new Value($value));
}
/** @return Comparison */
public function lt(string $field, mixed $value)
{
return new Comparison($field, Comparison::LT, new Value($value));
}
/** @return Comparison */
public function gte(string $field, mixed $value)
{
return new Comparison($field, Comparison::GTE, new Value($value));
}
/** @return Comparison */
public function lte(string $field, mixed $value)
{
return new Comparison($field, Comparison::LTE, new Value($value));
}
/** @return Comparison */
public function neq(string $field, mixed $value)
{
return new Comparison($field, Comparison::NEQ, new Value($value));
}
/** @return Comparison */
public function isNull(string $field)
{
return new Comparison($field, Comparison::EQ, new Value(null));
}
public function isNotNull(string $field): Comparison
{
return new Comparison($field, Comparison::NEQ, new Value(null));
}
/**
* @param mixed[] $values
*
* @return Comparison
*/
public function in(string $field, array $values)
{
return new Comparison($field, Comparison::IN, new Value($values));
}
/**
* @param mixed[] $values
*
* @return Comparison
*/
public function notIn(string $field, array $values)
{
return new Comparison($field, Comparison::NIN, new Value($values));
}
/** @return Comparison */
public function contains(string $field, mixed $value)
{
return new Comparison($field, Comparison::CONTAINS, new Value($value));
}
/** @return Comparison */
public function memberOf(string $field, mixed $value)
{
return new Comparison($field, Comparison::MEMBER_OF, new Value($value));
}
/** @return Comparison */
public function startsWith(string $field, mixed $value)
{
return new Comparison($field, Comparison::STARTS_WITH, new Value($value));
}
/** @return Comparison */
public function endsWith(string $field, mixed $value)
{
return new Comparison($field, Comparison::ENDS_WITH, new Value($value));
}
}

View File

@@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
enum Order: string
{
case Ascending = 'ASC';
case Descending = 'DESC';
}

View File

@@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
/** @internal */
enum Placeholder
{
case NotSpecified;
}

View File

@@ -1,242 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
use Closure;
use Countable;
use IteratorAggregate;
/**
* @phpstan-template TKey of array-key
* @template-covariant T
* @template-extends IteratorAggregate<TKey, T>
*/
interface ReadableCollection extends Countable, IteratorAggregate
{
/**
* Checks whether an element is contained in the collection.
* This is an O(n) operation, where n is the size of the collection.
*
* @param mixed $element The element to search for.
* @phpstan-param TMaybeContained $element
*
* @return bool TRUE if the collection contains the element, FALSE otherwise.
* @phpstan-return (TMaybeContained is T ? bool : false)
*
* @template TMaybeContained
*/
public function contains(mixed $element);
/**
* Checks whether the collection is empty (contains no elements).
*
* @return bool TRUE if the collection is empty, FALSE otherwise.
*/
public function isEmpty();
/**
* Checks whether the collection contains an element with the specified key/index.
*
* @param string|int $key The key/index to check for.
* @phpstan-param TKey $key
*
* @return bool TRUE if the collection contains an element with the specified key/index,
* FALSE otherwise.
*/
public function containsKey(string|int $key);
/**
* Gets the element at the specified key/index.
*
* @param string|int $key The key/index of the element to retrieve.
* @phpstan-param TKey $key
*
* @return mixed
* @phpstan-return T|null
*/
public function get(string|int $key);
/**
* Gets all keys/indices of the collection.
*
* @return int[]|string[] The keys/indices of the collection, in the order of the corresponding
* elements in the collection.
* @phpstan-return list<TKey>
*/
public function getKeys();
/**
* Gets all values of the collection.
*
* @return mixed[] The values of all elements in the collection, in the
* order they appear in the collection.
* @phpstan-return list<T>
*/
public function getValues();
/**
* Gets a native PHP array representation of the collection.
*
* @return mixed[]
* @phpstan-return array<TKey,T>
*/
public function toArray();
/**
* Sets the internal iterator to the first element in the collection and returns this element.
*
* @return mixed
* @phpstan-return T|false
*/
public function first();
/**
* Sets the internal iterator to the last element in the collection and returns this element.
*
* @return mixed
* @phpstan-return T|false
*/
public function last();
/**
* Gets the key/index of the element at the current iterator position.
*
* @return int|string|null
* @phpstan-return TKey|null
*/
public function key();
/**
* Gets the element of the collection at the current iterator position.
*
* @return mixed
* @phpstan-return T|false
*/
public function current();
/**
* Moves the internal iterator position to the next element and returns this element.
*
* @return mixed
* @phpstan-return T|false
*/
public function next();
/**
* Extracts a slice of $length elements starting at position $offset from the Collection.
*
* If $length is null it returns all elements from $offset to the end of the Collection.
* Keys have to be preserved by this method. Calling this method will only return the
* selected slice and NOT change the elements contained in the collection slice is called on.
*
* @param int $offset The offset to start from.
* @param int|null $length The maximum number of elements to return, or null for no limit.
*
* @return mixed[]
* @phpstan-return array<TKey,T>
*/
public function slice(int $offset, int|null $length = null);
/**
* Tests for the existence of an element that satisfies the given predicate.
*
* @param Closure $p The predicate.
* @phpstan-param Closure(TKey, T):bool $p
*
* @return bool TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
*/
public function exists(Closure $p);
/**
* Returns all the elements of this collection that satisfy the predicate p.
* The order of the elements is preserved.
*
* @param Closure $p The predicate used for filtering.
* @phpstan-param Closure(T, TKey):bool $p
*
* @return ReadableCollection<mixed> A collection with the results of the filter operation.
* @phpstan-return ReadableCollection<TKey, T>
*/
public function filter(Closure $p);
/**
* Applies the given function to each element in the collection and returns
* a new collection with the elements returned by the function.
*
* @phpstan-param Closure(T):U $func
*
* @return ReadableCollection<mixed>
* @phpstan-return ReadableCollection<TKey, U>
*
* @phpstan-template U
*/
public function map(Closure $func);
/**
* Partitions this collection in two collections according to a predicate.
* Keys are preserved in the resulting collections.
*
* @param Closure $p The predicate on which to partition.
* @phpstan-param Closure(TKey, T):bool $p
*
* @return ReadableCollection<mixed>[] An array with two elements. The first element contains the collection
* of elements where the predicate returned TRUE, the second element
* contains the collection of elements where the predicate returned FALSE.
* @phpstan-return array{0: ReadableCollection<TKey, T>, 1: ReadableCollection<TKey, T>}
*/
public function partition(Closure $p);
/**
* Tests whether the given predicate p holds for all elements of this collection.
*
* @param Closure $p The predicate.
* @phpstan-param Closure(TKey, T):bool $p
*
* @return bool TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
*/
public function forAll(Closure $p);
/**
* Gets the index/key of a given element. The comparison of two elements is strict,
* that means not only the value but also the type must match.
* For objects this means reference equality.
*
* @param mixed $element The element to search for.
* @phpstan-param TMaybeContained $element
*
* @return int|string|bool The key/index of the element or FALSE if the element was not found.
* @phpstan-return (TMaybeContained is T ? TKey|false : false)
*
* @template TMaybeContained
*/
public function indexOf(mixed $element);
/**
* Returns the first element of this collection that satisfies the predicate p.
*
* @param Closure $p The predicate.
* @phpstan-param Closure(TKey, T):bool $p
*
* @return mixed The first element respecting the predicate,
* null if no element respects the predicate.
* @phpstan-return T|null
*/
public function findFirst(Closure $p);
/**
* Applies iteratively the given function to each element in the collection,
* so as to reduce the collection to a single value.
*
* @phpstan-param Closure(TReturn|TInitial, T):TReturn $func
* @phpstan-param TInitial $initial
*
* @return mixed
* @phpstan-return TReturn|TInitial
*
* @phpstan-template TReturn
* @phpstan-template TInitial
*/
public function reduce(Closure $func, mixed $initial = null);
}

View File

@@ -1,32 +0,0 @@
<?php
declare(strict_types=1);
namespace Doctrine\Common\Collections;
/**
* Interface for collections that allow efficient filtering with an expression API.
*
* Goal of this interface is a backend independent method to fetch elements
* from a collections. {@link Expression} is crafted in a way that you can
* implement queries from both in-memory and database-backed collections.
*
* For database backed collections this allows very efficient access by
* utilizing the query APIs, for example SQL in the ORM. Applications using
* this API can implement efficient database access without having to ask the
* EntityManager or Repositories.
*
* @phpstan-template TKey as array-key
* @phpstan-template-covariant T
*/
interface Selectable
{
/**
* Selects all elements from a selectable that match the expression and
* returns a new collection containing these elements and preserved keys.
*
* @return ReadableCollection<mixed>&Selectable<mixed>
* @phpstan-return ReadableCollection<TKey,T>&Selectable<TKey,T>
*/
public function matching(Criteria $criteria);
}

Some files were not shown because too many files have changed in this diff Show More