MIAMI — The Miami Marlins acquired the pitching reinforcements they sought in a trade that cost them four players, including two minor leaguers.

Right-handers Andrew Cashner and Colin Rea were sent to Miami by the San Diego Padres in a seven-player deal, two people familiar with the deal said. They confirmed the trade to The Associated Press on condition of anonymity Friday because it will not be announced until medical reviews are completed.

The Marlins, eager to shore up their rotation for a playoff push, will also receive pitching prospect Tayron Guerrero for right-handers Jarred Cosart and Carter Capps and two minor leaguers, pitching prospect Luis Castillo and first baseman Josh Naylor.

Cashner is 4-7 this year with a 4.76 ERA in 16 starts, and has a career record of 30-49 with a 3.73 ERA in seven seasons. Rea, who is in his second major league season, is 5-5 with a 4.98 ERA in 19 games this year.

Cashner has a $7.15 million contract and becomes a free agent after this season. Rea, 26, has a salary of $510,200 and is under team control through 2018.

The prize in the deal for the Padres might be Naylor, 19, a left-handed power hitter taken by the Marlins in the first round of the 2015 draft. He is batting .269 with nine home runs this year for Single-A Greensboro.

Cosart went 13-11 in 2014 with Houston and Miami but has struggled since. This year he’s 0-1 with a 5.95 ERA in four starts with the Marlins, and 3-4 with a 4.09 ERA in 10 starts for Triple-A New Orleans.

Capps, a hard-throwing reliever, underwent Tommy John surgery in March and is expected to be ready for opening day 2017.

The Marlins are in contention for their first playoff berth since 2003 despite a shaky rotation. Aside from ace Jose Fernandez, their starters are 23-24 with an ERA of 4.40.

Miami’s rotation was further depleted last week when left-hander Wei-Yin Chen went on the disabled list because of a sprained elbow. Cashner and Rea will join Fernandez, Tom Koehler and Adam Conley.

advertisement | advertise on newsday

The trade is the second between the teams this summer. In June, the Marlins acquired All-Star reliever Fernando Rodney for a minor league pitcher.