Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add isInteger to help symfony form choicelist index #520

Closed
wants to merge 4 commits into from

2 participants

@woodspire

to be used with symfony/symfony#6150

isNumeric() does not do what we want, because 2.34 contains a dot and it won't pass the FormConfigBuilder::isValidName function in ChoiceList::addChoice()

@woodspire woodspire referenced this pull request in symfony/symfony
Closed

Fix ModelChoiceList problem with string key #6150

Felix Labrecque and others added some commits
Felix Labrecque When a foreign key is part of the primary key, setting it to null
will break the deletion code in the doSave() function on the base OM.

In doSave(), the ::create()->filterByPrimaryKeys($obj->getPrimaryKeys(false))->delete($con)

will not work, because one of the primary key field will be null.

I do not see any harm in removing this code. Tried it and did not see any problems.

Obviously, I have a composite primary key and part of this primary key is a foreign key from another table.
3e7a914
Felix Labrecque Should not have been committed a859d9c
@woodspire woodspire Merge branch 'master' of https://github.com/woodspire/Propel 74c6897
@woodspire

I tried to remove the 3e7a914 commit, but I am not sure I correctly did it.

Only the commit 5869220 is valid for this pull request.

@willdurand
Owner

Ok; Maybe close this PR, create a fresh branch and PR it. :)

@woodspire woodspire closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2012
  1. function to know if a column is an integer or not

    Felix Labrecque authored
    y
  2. When a foreign key is part of the primary key, setting it to null

    Felix Labrecque authored
    will break the deletion code in the doSave() function on the base OM.
    
    In doSave(), the ::create()->filterByPrimaryKeys($obj->getPrimaryKeys(false))->delete($con)
    
    will not work, because one of the primary key field will be null.
    
    I do not see any harm in removing this code. Tried it and did not see any problems.
    
    Obviously, I have a composite primary key and part of this primary key is a foreign key from another table.
Commits on Dec 3, 2012
  1. @woodspire

    Should not have been committed

    Felix Labrecque authored woodspire committed
  2. @woodspire
This page is out of date. Refresh to see the latest.
View
7 generator/lib/builder/om/PHP5ObjectBuilder.php
@@ -3805,7 +3805,6 @@ protected function addRefFKSet(&$script, $refFK)
$inputCollectionEntry[0] = strtolower($inputCollectionEntry[0]);
$collName = $this->getRefFKCollVarName($refFK);
- $relCol = $this->getFKPhpNameAffix($refFK, $plural = false);
$script .= "
/**
@@ -3822,10 +3821,6 @@ public function set{$relatedName}(PropelCollection \${$inputCollection}, PropelP
{
\$this->{$inputCollection}ScheduledForDeletion = \$this->get{$relatedName}(new Criteria(), \$con)->diff(\${$inputCollection});
- foreach (\$this->{$inputCollection}ScheduledForDeletion as \${$inputCollectionEntry}Removed) {
- \${$inputCollectionEntry}Removed->set{$relCol}(null);
- }
-
\$this->{$collName} = null;
foreach (\${$inputCollection} as \${$inputCollectionEntry}) {
\$this->add{$relatedObjectClassName}(\${$inputCollectionEntry});
@@ -3885,7 +3880,6 @@ protected function addRefFKRemove(&$script, $refFK)
$lowerRelatedObjectClassName[0] = strtolower($lowerRelatedObjectClassName[0]);
$collName = $this->getRefFKCollVarName($refFK);
- $relCol = $this->getFKPhpNameAffix($refFK, $plural = false);
$script .= "
/**
@@ -3901,7 +3895,6 @@ public function remove{$relatedObjectClassName}(\${$lowerRelatedObjectClassName}
\$this->{$inputCollection}->clear();
}
\$this->{$inputCollection}[]= \${$lowerRelatedObjectClassName};
- \${$lowerRelatedObjectClassName}->set{$relCol}(null);
}
return \$this;
View
10 runtime/lib/map/ColumnMap.php
@@ -212,6 +212,16 @@ public function isNumeric()
}
/**
+ * Whether this column is an integer
+ *
+ * @return boolean
+ */
+ public function isInteger()
+ {
+ return $this->type === PDO::PARAM_INT;
+ }
+
+ /**
* Whether this column is a text column (varchar, char, longvarchar).
* @return boolean
*/
Something went wrong with that request. Please try again.