/** * Constructor that can take a UserRight entity as first parameter and a Collection as second parameter * * @param UserRight $entity A UserRight entity object DEFAULT null * @param Collection $collection A collection object DEFAULT null */ public function __construct(UserRight $entity = null, Collection $collection = null) { parent::__construct($entity, $collection); if ($entity === null) { $this->entity = new UserRight(); } }
/** * Constructor that can take a User entity as first parameter and a UserCollection as second parameter * * @param User $user A user entity object DEFAULT null * @param UserCollection $userCollection A users collection object DEFAULT null */ public function __construct(User $user = null, UserCollection $userCollection = null) { parent::__construct($user, $userCollection); Ini::setIniFileName('conf.ini'); $this->params = Ini::getSectionParams('User'); }
/** * Check if a column value is not already in database if the column has a unique attribute constraint * * @param string $columnName The column name * @param mixed $value The column value * * @return bool True if the value is already in database and the column has a unique attribute constraint * else false * * @todo Move to EntityManager ? */ public function checkUniqueField(string $columnName, $value) : bool { $alreadyInDatabase = false; if (strpos($this->constraints['unique'], $columnName) !== false) { $sqlMarks = 'SELECT count(*) FROM %s WHERE %s = ' . DB::quote($value); $sql = EntityManager::sqlFormat($sqlMarks, $this->tableName, $columnName); $alreadyInDatabase = (int) DB::query($sql)->fetchColumn() > 0; } return $alreadyInDatabase; }
/** * Constructor that can take a RoomBan entity as first parameter and a RoomBanCollection as second parameter * * @param RoomBan $roomBan A room ban entity object DEFAULT null * @param RoomBanCollection $roomBanCollection A room ban collection DEFAULT null */ public function __construct(RoomBan $roomBan = null, RoomBanCollection $roomBanCollection = null) { parent::__construct($roomBan, $roomBanCollection); }
/** * Constructor that can take a Room entity as first parameter * * @param Room $room A Room entity DEFAULT null * @param RoomCollection $roomCollection A Room collection DEFAULT null */ public function __construct(Room $room = null, RoomCollection $roomCollection = null) { parent::__construct($room, $roomCollection); }
/** * Constructor that can take a RoomRight entity as first parameter and a Collection as second parameter * * @param RoomRight $roomRight A RoomRight entity object DEFAULT null * @param RoomRightCollection $roomRightCollection A RoomRightCollection DEFAULT null */ public function __construct(RoomRight $roomRight = null, RoomRightCollection $roomRightCollection = null) { parent::__construct($roomRight, $roomRightCollection); }