More often than not, the RDBM (which is usually My SQL when talking about PHP) is not capable of doing all of that (which is why moving away to a better RDBM is encouraged), in which case those things also need to happen at the Domain Object level.
It's the job of the domain object to validate itself.
Further, using this technique, we have implemented a set of validators such that validation against the property will only take place if a second property meets a given dependency constraint.
Also, we have implement optional validation ina similar manner such that, of the specified attributes, only those flagged as Optional will be executed if a second property meets a given dependency constraint.
You can validate multiple property values to infer business constraints within the object.