Just unpack 'gii' to application.protected and run /index.php?r=gii
protected
|-- gii
| `-- fixture
| |-- templates
| | `-- default
| `-- views
https://bitbucket.org/denis_medved/my-yii-extension
Just unpack 'gii' to application.protected and run /index.php?r=gii
protected
|-- gii
| `-- fixture
| |-- templates
| | `-- default
| `-- views
https://bitbucket.org/denis_medved/my-yii-extension
Error
Hi,
I have some tables with too many data. And when i try make the preview os fixtures, i get the error:
[12-Apr-2011 17:02:36] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40 bytes) in /usr/local/zend/apache2/htdocs/sdc/protected/framework/db/CDbCommand.php on line 496
Can you make same cache feature using files on something else? My database is so big and the 512M reserved to PHP is low.
LIMIT
Optional limit for rows, can help ?
Error
Yes :)
'out of memory' fixed
Fixed https://bitbucket.org/BuCeFaL/ext4yii/issue/2/out-of-memory
for PHP 5.3 only ..unless...
Hi,
static reference using a variable is not supported before PHP 5.3.
I've replaced
by
(FixtureCode.php Line 63 & 65)
and it seems to work fine.
Thanks for this useful extension !
fixture file name by aliases due to db table prefix
I was getting DB aliases like {{mytable}} that didn't work for me inside the UnitTest fixture call
probably because I use prefixes tbl_
I simply added
line 55
$tableName = strreplace(array("{{","}}"), array("tbl",""),$obj->tableName());
the prefix could even be pulled out of config db settings
fix of "fixture file name by aliases due to db table prefix"
the prefix could even be pulled out of config db settings
Thanks you for report.
Issues fixed: https://bitbucket.org/denis_medved/my-yii-extension/changeset/dd60b21284ce (line 57-59)
Fixed for Enum classes and Giix generated classes.
Giix generated classes have abstract classes inside models/base/ directory.
Also, I am using Enum class that has a private constructor and cannot be instantiated.
Modified version of scanDir function:
protected function scanDir($path){ foreach (scandir($path) as $file){ $filename = $path . DIRECTORY_SEPARATOR . $file; $className = pathinfo($filename,PATHINFO_FILENAME); if ('.' !== $file && '..' !== $file) if (is_file($filename = $path . DIRECTORY_SEPARATOR . $file) && 'php' === pathinfo($file,PATHINFO_EXTENSION) && false === strpos($className,'Enum')){ $reflection = new ReflectionClass($className); if (!$reflection->isAbstract()) $this->_models[] = $file; } else if (is_dir($filename)) { Yii::import($this->modelPath . '.' . $file . '.*'); $this->scanDir($filename); } } }
Re: "Fixed for Enum classes and Giix generated classes."
Fixed. Thanks for report.
Regeneration of fixtures
Thanks for this usefull extension.
I wanted to regenerate certain fixtures, but the code did not allow this.
You need to comment part of the following line in FixtureCode::prepare as indicated:
if (!in_array($tableName, $tableNames) /* && !file_exists($writeTo)*/)
During the preview, files do not get committed to disk and we get a list of files that would change and those the would not change, as usual.
Fixture regeneration
Remove files from 'application.tests.fixtures' (alias) if you need rebuild your fixtures.
Thanks for reporting.
Removing file
I understand that removing the file is a solution, but why not use a feature (difference, replace, ...) when it already exists?
hard wired my tables
Hi there, I also kept getting memory errors. But since I just wanted to try this extension before marrying it, I just hard coded my Model names into FixtureCode.php on line 54
$this->_models = [
"Cliptext", "Video" ];
This allowed me to generate the fixtures I needed fast, without the hassle of debugging this extension..
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.