portal dev

This commit is contained in:
yuri
2015-12-28 17:37:17 +02:00
parent ab3dfe4bf6
commit d081d6b2d9
4 changed files with 12 additions and 4 deletions
@@ -267,12 +267,14 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
protected function handleSpecifiedRelations(Entity $entity)
{
$relationTypeList = [$entity::HAS_MANY, $entity::MANY_MANY, $entity::HAS_CHILDREN];
foreach ($entity->getRelations() as $name => $defs) {
if (in_array($defs['type'], $relationTypeList)) {
$fieldName = $name . 'Ids';
$columnsFieldsName = $name . 'Columns';
if ($entity->has($fieldName) || $entity->has($columnsFieldsName)) {
if ($this->getMetadata()->get("entityDefs." . $entity->getEntityType() . ".fields.{$name}.noSave")) {
continue;
@@ -359,7 +361,8 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
}
}
} else if ($defs['type'] === $entity::HAS_ONE) {
if (empty($defs['entity']) || empty($defs['foreignKey'])) return;
if (empty($defs['entity']) || empty($defs['foreignKey'])) continue;
if ($this->getMetadata()->get("entityDefs." . $entity->getEntityType() . ".fields.{$name}.noSave")) {
continue;
}
@@ -369,7 +372,7 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
$idFieldName = $name . 'Id';
$nameFieldName = $name . 'Name';
if (!$entity->has($idFieldName)) return;
if (!$entity->has($idFieldName)) continue;
$where = array();
$where[$foreignKey] = $entity->id;
@@ -1 +1,3 @@
[{"name":"name"}]
[
{"name":"name"}
]
@@ -1 +1,3 @@
[{"name":"name","link":true,"width":"30"}]
[
{"name":"name","link":true}
]
+1
View File
@@ -38,6 +38,7 @@ class User extends \Espo\Core\ORM\Repositories\RDB
protected function beforeSave(Entity $entity, array $options)
{
parent::beforeSave($entity, $options);
if ($entity->isNew()) {
$userName = $entity->get('userName');
if (empty($userName)) {