Tag: CakePHP

CakePHP 3: Kurzfassung zum Verwenden von Migrations

CakePHP bietet mit Migrations die Möglichkeit, Änderungen an der Datenbankstruktur einzuspielen oder rückgängig zu machen. Der typische Ablauf zur Migration ist folgender:

Generating migrations from an existing database

If you are dealing with a pre-existing database and want to start using migrations, or to version control the initial schema of your application’s database, you can run the migration_snapshot command:

bin/cake bake migration_snapshot Initial

Generating a diff between two database states

You can generate a migrations file that will group all the differences between two database states using the migration_diff bake template. To do so, you can use the following command:

bin/cake bake migration_diff NameOfTheMigrations

Applying Migrations

Once you have generated or written your migration file, you need to execute the following command to apply the changes to your database:

bin/cake migrations migrate

Migrations Status

The Status command prints a list of all migrations, along with their current status. You can use this command to determine which migrations have been run:

bin/cake migrations status

 

CakePHP 2 Media Plugin: Media Dateien (Grafiken, …) mit verschiedenen Models nutzen

Unter http://grafikart.github.io/CakePHP-Media/index_en.html gibt es ein klasse CakePHP Plugin, mit dem sich Dateien verschiedenster Art (vorzüglich Grafiken, aber auch: png, jpg, pdf, mov, …) mit den Datensätzen anderer Models verknüpfen lassen. Im Video-Tutorial der Webseite wird ausführlichst beschrieben, wie dieses Plugin verwendet wird. Sehr zu empfehlen!