lean-api/skeleton/EntityGenerate/DeleteFormContext.php

22 lines
511 B
PHP

<?php
namespace %NAMESPACE%\%FORM_NS%;
use Lean\Api\Attribute\ContextField;
use %NAMESPACE%\{ %USE_ENTITY_NS% };
#[ContextField]
class %DELETE_FORM_CONTEXT_CLASSNAME% extends \Lean\Api\Lib\FormContext
{
# #[ContextField]
# public string $name;
public function valid(? %ENTITY_NS%\%CLASSNAME% $entity = null) : bool
{
if ( ! $this->getEntity()->isLoaded() ) {
$this->pushErrorMessage('lean.api.form.delete.error.entity');
}
return parent::valid();
}
}