for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the eav package.
* @author Alex Kuperwood <[email protected]>
* @copyright 2025 Alex Kuperwood
* @license https://opensource.org/license/mit The MIT License
*/
declare(strict_types=1);
namespace Kuperwood\Eav\Model;
use Kuperwood\Eav\Enum\_DOMAIN;
class DomainModel extends Model
{
public function __construct()
$this->setTable(_DOMAIN::table());
$this->setPrimaryKey(_DOMAIN::ID);
}
* @throws Exception
public function create(array $data) : int
$conn = $this->db();
$sql = sprintf(
"INSERT INTO %s (%s) VALUES (:name)",
_DOMAIN::table(),
_DOMAIN::NAME
);
$stmt = $conn->prepare($sql);
$stmt->bindParam(':name', $data[_DOMAIN::NAME]);
$stmt->execute();
return (int) $conn->lastInsertId();