I created an object that has a Sortable and you have one question about using it.
The methods of setting up and getting positions are not enough for me, so I want to make simple
moveUp and moveDown with the following code:
public function moveUp() {
++$this->position;
}
public function moveDown() {
if($this->position != 0)
--$this->position;
}
In this implementation, the moveUp method has no restrictions for increasing an element with already max. position. What is the best way to prohibit the increase of such items? I heard that doing custom queries directly in essence is not good practice, so how can I check if an element already has a maximum value?