public function execute(&$value, &$error) { $propertyId = $this->getContext()->getRequest()->getParameter('id'); $c = new Criteria(); $c->add(SchemaPropertyPeer::URI, $value); $object = SchemaPropertyPeer::doSelectOne($c); if ($object) { //check to see if the retrieved object has the same id if ($propertyId && $object->getId() == $propertyId) { return true; } else { $error = $this->getParameter('unique_error'); return false; } } return true; }
public function execute(&$value, &$error) { $schemaId = $this->getContext()->getRequest()->getParameter('schema_id'); $propertyId = $this->getContext()->getRequest()->getParameter('id'); $c = new Criteria(); $c->add(SchemaPropertyPeer::NAME, $value); $c->add(SchemaPropertyPeer::SCHEMA_ID, $schemaId); $object = SchemaPropertyPeer::doSelectOne($c); if ($object) { //it's ok to use if the status is deprecated if ($object->getStatusId() == 8) { return true; } //check to see if the retrieved object has the same id if ($propertyId && $object->getId() == $propertyId) { return true; } else { $error = $this->getParameter('unique_error'); return false; } } return true; }