-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added field entityId to requests when validating unique fields #144
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,24 @@ class UniqueEntity extends BaseUniqueEntity | |
*/ | ||
public $entityName = null; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public $entityId = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Store here whole entity object instead of fields. |
||
|
||
/** | ||
* @param BaseUniqueEntity $base | ||
* @param string $entityName | ||
* @param mixed $data | ||
*/ | ||
public function __construct(BaseUniqueEntity $base, $entityName) | ||
public function __construct(BaseUniqueEntity $base, $entityName, $data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
$this->entityName = $entityName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if (is_object($data) && method_exists($data, 'getId')) { | ||
$this->entityId = $data->getId(); | ||
} | ||
|
||
foreach ($base as $prop => $value) { | ||
$this->{$prop} = $value; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ $data = array ( | |
'ignoreNull' => '1', | ||
'groups' => array ('Default', 'User'), | ||
'entityName' => 'Acme\DemoBundle\Entity\User', | ||
'entityId' => 15, | ||
'data' => array ( | ||
'email' => '[email protected]', | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks better to pass all class with data.
$this->currentElement->getConfig()