I've started to refactor the ext:crawler to make it compatible with TYPO3 9LTS.
Currently we have a domain model based only on a database table + a TCA configuration:
https://github.com/AOEpeople/crawler/blob/master/ext_tables.sql#L48
https://github.com/AOEpeople/crawler/blob/master/Configuration/TCA/tx_crawler_configuration.php
I want to add a regular Domain Model and Repository for the Configurations instead, to benefit more from the code from TYPO3 Core.
My problem is currently:
I don't know how to migrate data from the already existing table tx_crawler_configuration to the new tx_crawler_domain_model_configuration without the users are loosing any data, or need to do any manual work.
I haven't found anything on this topic yet. I know I can "use foreign data source" but it's not foreign data, so not sure this is the best approach.
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/4-use-foreign-data-sources.html
I appreciate your input, thanks.
Torben Hansen just did something similar, when he migrated sf_bannners from using own Category concept to use the sys_category concept of TYPO3
What he does is creating a ext_update.php script that is being called automatically upon installation. You can see his commit here
https://github.com/derhansen/sf_banners/commit/02c2c6f1729b96940bb4dd0ca29761fe48d28c14
and probably catch him on Slack with any questions
Related
I'm currently given a running website, which using Zend-Framework 1.11 (to be precise, 1.11.11) with Doctrine 2.3 on it.
[I know, it's a very-very OLD version, but unfortunately, I can't upgrade it to newer version, since I'm really afraid that it will causing more trouble and destroy this website entirely lol!!]
I'm new with this ZF, but having a bit experience with other framework, such as - Laravel and CodeIgniter.
So, my question is -
How can I add a new table (or column) to an existing database (or table) using ZF-way or CLI-way?
For example - I'm having a Table called Supplier, with 4 columns
id
name
contact
phone
I want to add mobile_phone, a new column. How can I do that?
I need to add a new Table, exactly the same like Supplier above, how can I do that?
I experienced before, to add 2 new tables, BUT I did that manually... and it's such a pain.
Because, I need to create a file, edit the existing Model file (to create a relationships/FK) and then edit the Model Entity, and surprisingly, when I try to create its functionality, like Insert/Update/Delete, it shows me an error, that I need to create a Model Proxy too, which I check, it suppose be auto-generated.
Is there any good way to add that table (or column)? maybe using CLI or else?
Is there a way, to check, IF I can use doctrine-CLI? maybe something like doctrine --v? or something like that
I did try php doctrine list on project root folder and it fails - Could not open input file: doctrine.
I found those questions (maybe) same like here - Add a new column in Doctrine 2 in Zend Framework.
But, to be honest, I really don't know how it works and is that can be executed on project root folder?
I did try check on the details link about doctrine CLI that provided there, but still, I don't understand how to set it up.
On that link too, it drives me to this link, about how to set-up doctrine CLI, but, as I state, I kind of confuse, how I add / create the file.
In summary, I want to know, is there any way, to create a new Table? Like, on Laravel, we can create a new Table using their artisan:make?
And, is there a better way, to add new a Column on the existing Table?
FYI - I can do this syntax on my project root folder zf show version.?, IF, I can use zf syntax to create table and adding new column, I'm okay with that too. :)
Thanks in advance & Cheers! :)
I'm really sorry, if this thread/question is too long or not a straight-forward question, as I'm getting frustrated, to find a good documentation about this old ZF version
I am trying to figure out how best to modify a MySQL Table's existing Column using the CakePHP Migrations plugin. I do not need to add or drop the column, I simply want to modify a string column's length.
Currently the column is defined as a varchar(50); I am repurposing the column and wish to define it as varchar(2000).
The goal of the migration is to be part of an automated deployment taking place on a standard CakePHP web app installation on a typical web server.
Near as I can tell, it looks like the only way (other than an ALTER statement) to accomplish this using the Migrations Plugin would be to:
rename the column
add the new column
Move/copy the existing data to the new column
drop the old column
Perhaps I have missed the discussion in the documents and countless tutorials and how to's out there on a better way to accomplish this, but this seems like a cumbersome and self defeating method.
I have been through both the CakePHP Migration Plugin's documentation and the Phinx's documentation but am failing to see the recommended method for this change. I appreciate any input for this.
Unfortunately the Phinx docs aren't that complete, there seem to be various undocumented methods, like the one you are looking for: \Phinx\Db\Table::changeColumn()
https://github.com/robmorgan/phinx/blob/v0.4.6/src/Phinx/Db/Table.php#L392
https://github.com/robmorgan/phinx/issues/682
The following should work
$table = $this->table('table_name');
$table->changeColumn('column_name', 'string', [
'limit' => 2000
]);
$table->update();
Very simple question I'm not able to find a good answer for...
I have a lot of Entities in my Symfony 2.6 - when ever a user makes some changes to any one of them I would like to have a log entry with who/what/where.
Who maked the changes. (user id)
What did he/she do. ( POST/PUT data)
Where was this done (which entity / url)
[EDIT]
It could perhaps just be a table with these columns:
userid
data
entity
created
[/EDIT]
Is there a bundle for this?
For my projects I usually use the EntityAudit bundle. What it does is save a copy of the old state whenever an audited entity is changed. By comparing those to the current version you can see what has changed.
It also gives you a revision history that lists all the entities that have changed in your database.
You have several Bundles out there that do this, a couple of which have already been mentioned. I've had a lot of success with Gedmo Doctrine Extensions.
Some Documentation here: http://symfony.com/doc/current/cookbook/doctrine/common_extensions.html
And installation instructions here:
https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/symfony2.md
The installation is the tough part. Once that's done, all you need to do is annotate any entity fields you wish to log.
I have a Project model and a Comment model that are connected with has many relationship( project -> comment ).
Im currently using CTimestampBehavior to keep the created and updated fields in sync but i want the project model change update timestamp when a comment is added, changed or deleted. I got several of cases like this in my project and I would just like to know the best way to go about all of this.
Can I use AfterSave() on each model and tell it to update its parent? That would trigger a chain when a comment is updated that would update all the way to the top. Should I do it this way or does Yii have support for this?
To my knowledge Yii does not have support for this feature. Not sure how that should be implemented in the framework either.
Can't really see any negative sides with this, and I'd definitely look into the same approach myself.
So heres the scenario:
Currently we have a development site with 3 models. We found we didn't like our initial schema and added a few rows. We re-generated the schema (doctrine:build-sql).
Now it forced us to drop and re-create all the tables and dump back in all the information as no ALTERS were created but rather CREATE statements only. Not a problem...
The big problem came to updating the models. After we ran a build-all and such a few errors popped up i.e. "Widget sort not found" etc. We figured out we needed to rebuild the models. So we can a symfony doctrine:build-models course Course (Course was the table name...course the models). This worked great and fixed the broken links within Symfony.
The downside is all custom code in the actions.class.php file was lost as were customizations to the _form.php page.
My question on this is, how do we store our own actions so they are not lost if you update a models schema? Similarly templates and such are re-generated to but do not hold any customizations.
There surely must be a simple solution to updating a model's schema in symfony?
Found my answer to this. You don't update the module per say but the models of the database. You can change your schema.yml file and do a symfony migration
http://www.slideshare.net/denderello/symfony-live-2010-using-doctrine-migrations
If you just want CRUD/minimal customisation, you can do this with the admin generator:
./symfony doctrine:generate-admin appname Course
A regular module can't be updated once generated without losing customisations - they are intended to be a starting point.