Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Dregond Rahl
Discussions
26
Comments
54
Activity
many-to-many insert
Jelmer Schreuder wrote on Sunday 22nd of May 2011: @Dregond Just retrieve the existing Tag model instance like I showed before and add it to the $list->tags array, it'll be automaticly inserted into the table. @Huglester Your suggestion…
Comment by
Dregond Rahl
May 2011
permalink
many-to-many insert
The code below works just fine, for new tags it inserts the values to the 'tags' table and the 'list_tags' table. The problem is when a tag already exists, then it won't be able to insert it to the database. Yes I can retri…
Comment by
Dregond Rahl
May 2011
permalink
many-to-many insert
Jelmer Schreuder wrote on Saturday 21st of May 2011: That really has nothing to do with the Orm, that's because you made the column unique and entered a duplicate. Yeah, but say in a situation where 'tags' table the 'name…
Comment by
Dregond Rahl
May 2011
permalink
many-to-many insert
Jelmer Schreuder wrote on Saturday 21st of May 2011: Just try Fuel\Core\Database_Exception [ 1062 ]: Duplicate entry 'Action' for key 'name' [ INSERT INTO `tags` (`type`, `name`) VALUES ('Genre', 'Action'…
Comment by
Dregond Rahl
May 2011
permalink
many-to-many insert
Jelmer Schreuder wrote on Saturday 21st of May 2011: $list->tags is an array, you can add new objects to that array. so it would be like this: $list->tags = array( new Model_Tag(array( …
Comment by
Dregond Rahl
May 2011
permalink
Symbols in URL like @%^
Jelmer Schreuder wrote on Saturday 21st of May 2011: Could you check if this solves it: https://github.com/fuel/core/commit/8d2e3656434c328723fd5ac33cd75a6df0142ae3 Yups seems to have solved it, Thanks.
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Jelmer Schreuder wrote on Friday 20th of May 2011: The problem is that the relation needs the primary keys in order to be established, but to get to that the model_to still had to get saved first. This shouldn't be necessary and I fixed it i…
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Controller: http://scrp.at/Z1 Model_List: http://scrp.at/Z2 Model_Shows: http://scrp.at/Z3 DBDump: http://scrp.at/Z4 Note: All row retrieving is working fine with the relationships.
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
say we are making a new Listing for a new TV Show, this would involve Model_List and Model_Shows. List -- id (auto,PK) --title --content Shows --id (auto, PK) --list_id (FK) --episodes --airdate Model_List and Model_Shows are in one-to-one …
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
I tried a few more times even with the structure by WanWizard, but still the list_id which is the FK is not being passed from the lists table to the related one on insert. Is it stored in any specific variable ?
Comment by
Dregond Rahl
May 2011
permalink
AJAX response in Controller_Template
Thanks Sebastien, also is it safe to echo from the controller ? or would a $this->response(); work like with the REST controller ?
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Thanks for all the information both of you. I'll work on restructuring the database. So After inserting to 'List' table, what would be the best method I could use to get the 'list_id' to be inserted into the 'Music…
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Jelmer Schreuder wrote on Wednesday 18th of May 2011: Each table is expected to have its own unique primary key(s), if you don't auto-increment them you need to set those IDs manually before saving. If they are in a one-to-one relationshi…
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Jelmer Schreuder wrote on Wednesday 18th of May 2011: No, that just means you didn't make it auto-increment. Model_List table auto increments, Model_Music does not auto increment since it needs to get the list_id from Model_List, which is…
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Jelmer Schreuder wrote on Wednesday 18th of May 2011: When saving relations like this, the apropriate foreign keys will be set automaticly. Unfortunately, it seems to be inserting '0' as the primary key. When I post a second time it …
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
Jelmer Schreuder wrote on Wednesday 18th of May 2011: The way you do it it'll be a stdClass object and not a Model_Music object. You need to create the new Model_Music instance yourself: $list = new Model_List(); $list->list_title …
Comment by
Dregond Rahl
May 2011
permalink
ORM inserts with relationships
I gave it a try for a $has_one relationship between Model_List and Model_Music and it returns this error: Orm\Exception [ Error ]: Invalid Model instance added to relations in this model. Models seem right, so here is the basic code $list = …
Comment by
Dregond Rahl
May 2011
permalink
Modules + ORM
Frank Bardon wrote on Thursday 12th of May 2011: Well, maybe there's a better solution... but here's something I did in my models. I created a Tagable interface and a Tag class. In my models I put a few methods with some basic functiona…
Comment by
Dregond Rahl
May 2011
permalink
Modules + ORM
Haha, that explains alot *sigh* Any more ideas I can try, I want to learn the proper way to handle such a system. Can't be writing crappy code with Fuel
Comment by
Dregond Rahl
May 2011
permalink
Modules + ORM
Frank Bardon wrote on Wednesday 11th of May 2011: Would you be able to use an abstract class and implement them in each controller? // Tags.php abstract class Tags { public function do() {} } // Controller.php... class Co…
Comment by
Dregond Rahl
May 2011
permalink
Modules + ORM
Thanks for the reply, ill give it a try. Any ideas on what i can do to improve to file structure to minimize repeated code? it Doesn't need to be modules, just someway I can utilize and share the features (likes, recommended, lists, tags) bet…
Comment by
Dregond Rahl
May 2011
permalink
fuelphp nginx vhost config
https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/ In the above article it explains certain configurations from tutorials of Nginx that may cause a vulnerability, read over it if y…
Comment by
Dregond Rahl
February 2011
permalink
many to many, and its related rows
Jelmer Schreuder wrote on Saturday 23rd of April 2011: Not yet, this will be in 1.1: https://github.com/fuel/orm/issues/6 Thanks for the info.
Comment by
Dregond Rahl
April 2011
permalink
Memory Usage and Speed vs Code Igniter
I did some tests regarding this, and CI is all good, but I think Fuel has more potential. Its basic DB class handles much better than CI's AR class memory wise, and possibly CPU. The only time when Fuel uses more memory is with the ORM class, …
Comment by
Dregond Rahl
April 2011
permalink
DB Class
Harro Verton wrote on Thursday 7th of April 2011: There is no get() in executing a query: $this->record = \DB::select()->where('id', '=', $value)->from($table)->execute(); Fuel\Core\Fuel_Exception [ Error ]: …
Comment by
Dregond Rahl
April 2011
permalink
More Comments
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
About
Username
Dregond Rahl
Joined
March 2011
Visits
0
Last Active
July 2012
Roles
Member