Yoast\WP\Lib
ORM::get_dirty_column_names()
Extracts and gathers all dirty column names from the given model instances.
Метод класса: ORM{}
Хуков нет.
Возвращает
Массив
. The distinct set of columns that are dirty in at least one of the models.
Использование
$ORM = new ORM(); $ORM->get_dirty_column_names( $models );
- $models(массив) (обязательный)
- Array of model instances to be inserted.
Код ORM::get_dirty_column_names() ORM::get dirty column names Yoast 23.8
public function get_dirty_column_names( $models ) { $dirty_column_names = []; foreach ( $models as $model ) { if ( ! $model->orm->is_new() ) { throw new InvalidArgumentException( 'Instance to be inserted is not a new one' ); } // Remove any expression fields as they are already baked into the query. $dirty_fields = \array_diff_key( $model->orm->dirty_fields, $model->orm->expr_fields ); $dirty_column_names = \array_merge( $dirty_column_names, $dirty_fields ); } $dirty_column_names = \array_keys( $dirty_column_names ); return $dirty_column_names; }