Skip to content
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

Fix Sqlite persister and Behavior locator #1088

Merged
merged 2 commits into from Dec 24, 2015
Merged

Fix Sqlite persister and Behavior locator #1088

merged 2 commits into from Dec 24, 2015

Conversation

cristianoc72
Copy link
Member

SQLite keeps track of auto-increment fields in an internal table, called sqlite_sequence.
https://www.sqlite.org/fileformat2.html#seqtab

With this commit, Propel\Runtime\Persister\SQL\SQLitePersister::readAutoIncrement method
takes values from this table, preventing FOREIGN KEY violation errors.
This commit also provides a test, which failed with previous versions of the persister.
The previous algorithm, to read auto-increment fields, is still used if there's no sqlite_sequence table entry, for the given field.

Fix Propel\Generator\Util\BehaviorLocator class: now behaviors are
correctly found and test suite builds the fixtures.
SQLite keeps track of autoincrement fields in an internal table, called `sqlite_sequence`.
With this commit, Propel\Runtime\Persister\SQL\SQLitePersister::readAutoIncrement method
takes values from this table, preventing `FOREIGN KEY violation` errors.
This commit also provides a test, which failed with previous versions of the persister.
@marcj
Copy link
Member

marcj commented Dec 24, 2015

Very nice, cool :)

marcj added a commit that referenced this pull request Dec 24, 2015
Fix Sqlite persister and Behavior locator
@marcj marcj merged commit f365e14 into propelorm:data-mapper Dec 24, 2015
@@ -174,7 +174,7 @@ public function getBehavior($name)
*/
private function getCoreBehavior($name)
{
$phpName = NamingTool::toCamelCase($name);
$phpName = ucfirst(NamingTool::toCamelCase($name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt the naming tool already provide the correct name (otherwise it doesnt deserve its name)?

@cristianoc72
Copy link
Member Author

@marcj imho I should consider @staabm 's suggestions: do you prefer to revert this pr or I'll include them into my next one?

@cristianoc72 cristianoc72 deleted the sqlite-persister branch April 9, 2016 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants