Menu
  • HOME
  • TAGS

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails

php,idiorm

Your error means that you're trying to insert a value into the column "usuario_idusuario" in the "empleado" table that does not exist in the column "id" in the "usuario" table. Without seeing the query that's being run and the table values, I can't give you any more info. You need...

Message: Undefined index: id

php,idiorm

According to your var dump $proveedores is an array with 2 elements which represent 2 rows in your table. The query that you issued seems to have returned 2 rows as a result to access them you should do something like the following $id1 = $proveedores[0]['id']; $id2 = $proveedores[1]['id']; ...

Paris ORM, has_many_through with restrictions

php,idiorm,paris-orm

I took a punt and the answer was easier than I anticipated: public function featuredProfiles() { return $this->profiles()->where('featured', 'Yes'); } The where is added as part of the query on the joined table....

Need help in Paris php quering

php,idiorm

I have solved this issue my self $user = Model::factory('User')->find_many(); // Find the posts associated with the user //$posts = $user->posts()->find_many(); I looped through $user and passed each user id to $user->posts()->find_one(); sudo code is here: foreach($user as $usr) { $posts = $user->posts()->find_one($usr->Id); } ...